Need a way to play one SFX at a time
KrisBee
Member Posts: 6
I'm working on a project with many different touch events. A problem arises when the user touches an actor once to trigger the audio for that (first touch) event, then quickly touches a second and/or third time triggering the SFX specific to those events. Creating only very short duration SFX will go a long way towards addressing the issue, but it isn't always a workable solution.
Is there a way to ensure only one SFX audio will play at a time; having the playing audio stop when another starts?
Kris
Is there a way to ensure only one SFX audio will play at a time; having the playing audio stop when another starts?
Kris
Best Answers
-
jonmulcahy Posts: 10,408Use play music instead of play sound.
Sounds can be stacked
Music can only play one at time -
SlickZero Houston, TexasPosts: 2,870The only thing I can think of is to use the "play music" behavior for the sounds like jon suggested, and use "play sound" behavior for the music. The music would have to be less than a minute I believe, (possibly 30 seconds? I can't remember off hand) and looped to work properly, and you can then use the "stop music" behavior in your buttons to stop the current sound, and use "play music" after that to start the new one.
-
theCodeMonsters Posts: 359This would be a last resort but, here's what I would do.
1. Make a global Boolean set it to true
2. Make it so that the sound will only play (in addition to your other conditions) if the boolean is true
3. Once the Rule is met, with the behavior of the sound playing, set the boolean to false.
4. Set a timer for however many seconds you want of delay, and after X amount of seconds set the boolean to true again.
Do this for all of your sounds and only one should play at a time.
Answers
Kris
Thanks to both for the replies
K
Thanks
Kris
Thanks again
Kris