Fmod Stop Sound And Play The Same Sound
#1
Posted 08 April 2010 - 10:01 AM
Do you have ideas?
-Pri._AI
#2
Posted 15 August 2010 - 12:39 PM
It's too difficult to caption in the topic name but here's my problem. I want to make the sound stop when I play the same sound. Don't understand? For example when I click the object, a 3 second sound plays. Clicking again will play but clicking rapidly will also repeat the sound. FMODinit() won't help because it will affect other sounds.
Do you have ideas?
-Pri._AI
I have the very same problem! I'm working on project for kids in my class.
What I'm trying to do is that everytime I press a key (or let's say...left mouse-click) it should start the sound loop assigned to the left mouse-click and immediately stop the previous loop (the same loop sound). I need to do the same for right click and it mustn't affect the left-click loop (wheter it's playing or not). And the timing is essential because the player has to sync two music themes (start 1 theme and then start 2). I'm sorry for my lousy english but I think you'll get the idea. Every opinion appreciated.
#3
Posted 15 August 2010 - 12:51 PM
-MoK
#4
Posted 15 August 2010 - 04:50 PM
When you play the sound, store the ID in a variable somewhere.
sound_id = FMODSoundPlay( sound );
Next time you want to play the sound, check if the last instance is still playing. If so then stop it.
if FMODInstanceIsPlaying( sound_id )
then { FMODInstanceStop( sound_id ); }
sound_id = FMODSoundPlay( sound );
#5
Posted 15 August 2010 - 09:30 PM
The FMOD playback functions return a sound instance ID. There are also functions to manipulate specific sound instances.
When you play the sound, store the ID in a variable somewhere.sound_id = FMODSoundPlay( sound );
Next time you want to play the sound, check if the last instance is still playing. If so then stop it.if FMODInstanceIsPlaying( sound_id ) then { FMODInstanceStop( sound_id ); } sound_id = FMODSoundPlay( sound );
Thank you very much! I haven't try it yet but it sounds very promising!
#6
Posted 13 December 2011 - 06:34 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











