Page 1 of 1

setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 2:18 pm
by summer_goth
Hi there,

I've been adding options to change the volume in our game. So I've been hoping to use setVolume(0,0) to turn the sound off on all channels.

However the music continues playing. If I change the first variable to 1 (Channel) then the music goes off but as soon as another music file is opened the music plays at full blast again.

How do I change the volume so that it stays that way for all music files that will be opened? (Without having to change the volume every time that I open a music file)

-------------------------

Another bug is with the PlayMusic2 action. Currently it will not accept 0 as the loop count. Only in the script editor will it accept it as the loop count and thus play in an infinite loop.

Re: setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 3:08 pm
by makslane
There is only one music at time always in the channel 1.
To change the music volume, you can also use the musicvol variable:

Code: Select all
musicvol = 0;

Re: setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 3:10 pm
by Kalladdolf
summer_goth wrote:Another bug is with the PlayMusic2 action. Currently it will not accept 0 as the loop count. Only in the script editor will it accept it as the loop count and thus play in an infinite loop.


so that's why it didn't work! :o
thanks for the hint, summer :)

Re: setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 3:15 pm
by makslane
The setVolume(0,0) will works on all channels other than the music channel.
Set the volume of the music channel by using setVolume(1, 0) or musicvol = 0;

Re: setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 3:50 pm
by summer_goth
Thank you very much Makslane.

The problem however is that if I set the music volume to 0.1 and then load a different music file the new music file will be back at the highest volume.

Should I just change the volume immediately every time after loading a new music file?

Re: setVolume(0, 0) Not Working

PostPosted: Thu Jan 24, 2008 3:53 pm
by summer_goth
Agh sorry, I'm an idiot.

I can set the volume when loading the file in the PlayMusic function.

Sorry my fault. :wink: