Play and Stop Sound
der_chinty
Member Posts: 5
Hi all,
i just want to create a little Soundboard App.
With GameSalad it looks quite easy.
But my Question is, i add an Actor for example "Sound 1" and another Actor with "Sound 2".
So if i hit the "Sound 1" Actor it plays the Sound, but i want to Stop the Sound if i press the "Sound 1" Actor again or if i press the "Sound 2" Actor.
I dont figure it out how i can do this.
i just want to create a little Soundboard App.
With GameSalad it looks quite easy.
But my Question is, i add an Actor for example "Sound 1" and another Actor with "Sound 2".
So if i hit the "Sound 1" Actor it plays the Sound, but i want to Stop the Sound if i press the "Sound 1" Actor again or if i press the "Sound 2" Actor.
I dont figure it out how i can do this.
Comments
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
When Touch is Pressed
Do Play Sound xxx.mp3
Else
nothing
So if i uncheck the "Run to Completion" i need to touch at the Actor as long as i want to hear the sound.
I was wondering about this as well.
I have a couple of long sound effects and I need the ability to stop the sound effect from playing when I choose, but it does not seem like I have any control over the sound effect after it has started playing. I can off course lower the sound effect volume on the device, but does not work for me since I want other sound effects to continue to play. Did anyone figure out a way to stop a sound effect from playing after it has been started?
So you're wondering how to play the sound with one click, and then when you press the button again it stops playing the sound?
You can watch this video:
Thanks for the suggestion @allc1865, but this video only explain how you can stop playing music and not for stopping sound effects. GS treats music and sound effects very differently.
One hard core option is to cut all longer sound effects into one second clips and then check every second if the sound effects player should play the next piece of the long SFX.
That's a lot of work though. Would be nice to have a "Stop SFX" behavior in GS.
Make integer attribute game.active_sound
And then add integer self.sound_number to your "button" actors and change value to 1,2,3,4...
When button actor is released, change attribute game.active_sound to self.sound_number.
And then make rule When game.active_sound = self.sound_number -> play sound 'xxxx'
Hi @viking
Back to the original question in this thread by @der_chinty, that's relatively straightforward: in the toggled sound button, put:
You're asking for something slightly different, but it's similar:
When you want the first sound to start at anytime, put in a button or wherever:
and in another sound button (for Sound02, for instance), to stop that first sound,
Edit: typing when @opa was typing
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps