Page 1 of 1
is there something like a global DisableAudio??

Posted:
Sat Apr 23, 2011 5:52 pm
by sonicfire
hi there,
i realized it would be cool for my games to enable or disable music/soundeffects.
So my question is, is it possible to disable all audio globally somehow?
(Other than using variables)?
Thanks!
Re: is there something like a global DisableAudio??

Posted:
Sat Apr 23, 2011 7:52 pm
by SuperSonic
Hmm, I don't know how to do it other than using variables. But if you wanted to use them, it wouldn't be hard. I could give you a tutorial if you want

Re: is there something like a global DisableAudio??

Posted:
Sat Apr 23, 2011 9:59 pm
by Game A Gogo
I think there is a function named "SetVolume" where channel 0 is all samples and channel 1 is music
Re: is there something like a global DisableAudio??

Posted:
Sat Apr 23, 2011 10:00 pm
by lcl
In ge, there is a variable called musicvol.
I haven't tried it, but I think it controls the global volume of all sounds & music.

Then you can just set it to 0.

And to 1 for having the sounds work again.
Re: is there something like a global DisableAudio??

Posted:
Mon May 02, 2011 6:38 am
by sonicfire
thanks, guys!

i´m currently just using the long-winded variant of checking audio at every sample play.
(e.g. if (audioEnabled) { play dat sound! })
Re: is there something like a global DisableAudio??

Posted:
Mon May 02, 2011 6:50 am
by skydereign
Setting musicvol should work, but if that isn't what you wanted, and you are going to use that if statement, make sure to use a function. I use a custom function to play sounds and music, that takes the music file's name, that way I can set its volume and whether or not it plays in the function, without having to do that for every instance of sound.
Re: is there something like a global DisableAudio??

Posted:
Mon May 02, 2011 3:39 pm
by sonicfire
the musicvol method doesnt work for me, since it seems that it olnly affects music? (or everything played on channel zero).
so thats why i decided to go the "if (can i play audio?) yes? then play)"

Re: is there something like a global DisableAudio??

Posted:
Mon May 02, 2011 6:47 pm
by AnarchCassius
In the end variables will be nicer because it means you can implement volume controls, not just on/off. It's nice to be able to have the sound low enough that you aren't driving the other people on your train or in your house crazy but loud enough you can at least hear it.
Re: is there something like a global DisableAudio??

Posted:
Wed May 04, 2011 9:43 pm
by sonicfire
thats right!
TO AKR / MAKSLANE: i finally had the chance to test my game on an ipod touch 3gs (iOS 4.2 something).
i noticed GE stops music that´s playing in the background as soon as i launch the App. Guess that´s intended?
However, is there (in the future) a way or possibility to let the user hear his music while playing GE games ???Thanks!
