Jump to content

Photo

Sound is a hard thing.


4 replies to this topic

#1 Captain Spazer OFFLINE  

Captain Spazer

    Star Raider

  • 80 posts

Posted Mon Dec 19, 2016 11:36 AM

I'm not afraid to admit that sound is not my speciality, infact I find it hard to deal with adding sound elements to a game sometimes.

 

Anyway, I'm having an issue I can't resolve on my own. The idea is that when the joy0fire button is pressed there would be short bleep sound, but it never ends, what did I do wrong?

 

   if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire

   if _Bit1_FireB_Restrainer{1} then goto __Skip_Fire

   _Bit1_FireB_Restrainer{1} = 1

   _Bit0_Player0_Sword{0} = 0

   if joy0fire then _Bit0_Player0_Sword{0} = 1

   if _Bit0_Player0_Sword{0} && q=0 then player0x=player0x+1 : a=a+1 : player1x=player1x+1 : m=1

__Skip_Fire

   if !joy1fire then _Bit3_FireB1_Restrainer{1} = 0 : goto __Skip_Fire2

   if _Bit3_FireB1_Restrainer{1} then goto __Skip_Fire2

   _Bit3_FireB1_Restrainer{1} = 1


   _Bit2_Player1_Sword{0} = 0

   if joy1fire then _Bit2_Player1_Sword{0} = 1

   if _Bit2_Player1_Sword{0} && z=0 then player0x=player0x-1 : b=b+1 : player1x=player1x-1 : n=1

__Skip_Fire2

 if m>0 then o=o+1
 if n>0 then o=o+1
 if o>0 && o<30 then AUDV1 = 10 : AUDC1 = 12 : AUDF1 = 12
 if o=0 then AUDV1=0
 if o=30 then AUDV1=0
 if o=30 then o=0 ; m=0


Edited by Captain Spazer, Mon Dec 19, 2016 11:55 AM.


#2 SpiceWare ONLINE  

SpiceWare

    Quadrunner

  • 11,205 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Mon Dec 19, 2016 12:02 PM

have you tried my sound effect driver?



#3 atari2600land OFFLINE  

atari2600land

    Waffles:

  • 10,651 posts
  • Man's best invention. Ever.
  • Location:Salem, Oregon

Posted Tue Dec 20, 2016 12:39 PM

The last line of the code seems wrong.

if o=30 then o=0 ; m=0

Perhaps if you changed the semicolon to a colon?



#4 Gemintronic OFFLINE  

Gemintronic

    Jason S. - Lead Developer & CEO

  • 8,821 posts

Posted Tue Dec 20, 2016 1:36 PM

Sound has become pretty simple with my technique here:

The smallest sound system I've come up with is something like this: I use two variables "sounda" and "soundb". The length of time a sound is played is represented by the current value of the variable. The sound changes with the variable value as well so longer playing sounds will be different from shorter ones. If a sound is decremented down to zero I kill the volume.

main
 if sounda > 0 then sounda = sounda - 1 : AUDC0 = 8 : AUDV0 = 4 : AUDF0 = sounda else AUDV0 = 0
 if soundb > 0 then soundb = soundb - 1 : AUDC1 = 2 : AUDV1 = 4 : AUDF1 = soundb else AUDV1 = 0

The only thing that takes times is experimenting with AUDCx, AUDFx and duration values.

 

 

UPDATE:  I just realized I keep posting this code snippet with no response.  So, I made a more demonstrative topic here:

http://atariage.com/...e-with-example/



#5 Captain Spazer OFFLINE  

Captain Spazer

    Star Raider

  • Topic Starter
  • 80 posts

Posted Sun Dec 25, 2016 10:11 AM

Thanks guys, you where an enormous help, I got it working =)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users