re-occuring sound

Posted By: Nowherebrain

re-occuring sound - 08/04/09 15:13

My sound keeps initiating, looping over itself over and over, until the engine shuts down....
I wonder why the following does not seem to work...
Code:
if(snd_playing(engine_thrust) == 0)
{					
 snd_play(engine_thrust,50,0);
}


I call this inside the player action(loop).
Posted By: Nowherebrain

Re: re-occuring sound - 08/04/09 15:15

the sound file is defined as a standard sound...
Code:
SOUND* engine_thrust = "some_sound.ogg";//this is not the actual filename


Posted By: Claus_N

Re: re-occuring sound - 08/04/09 16:08

You need to use a sound handle, like this:

Code:
var snd_handle = 0; // global variable
...
if(snd_playing(snd_handle) == 0)
{					
 snd_handle = snd_play(engine_thrust,50,0);
}



Edit:
And if you want the sound to play over and over again, use snd_loop instead (stop it again using 'snd_stop(snd_handle);').
Posted By: Nowherebrain

Re: re-occuring sound - 08/04/09 16:27

Yeah, after looking in the manual I figured it out....thank you, I guess you cant redefine the same engine object to itself...or whatever I was doing...I get it now...again thanks.
© 2024 lite-C Forums