Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Gribbler on Fri 11/07/2014 15:45:47

Title: How to set default game music volume?
Post by: Gribbler on Fri 11/07/2014 15:45:47
I have music volume slider in the game's GUI but it's always set to the max volume. How can I change it? I consulted manual and found it can be done manually. I want the slider to be in the middle position by the default so I put:

Code (ags) Select
System.Volume = 50;

in the first room load code. But it doesn't change the slider. It's still set on max.

And this is my slider code:
Code (ags) Select
function sldMusic_OnChange(GUIControl *control)
{
//  SetMusicMasterVolume(sldMusic.Value); 
Game.SetAudioTypeVolume(eAudioTypeMusic, sldMusic.Value, eVolExistingAndFuture);

Title: Re: How to set default game music volume?
Post by: Crimson Wizard on Fri 11/07/2014 15:50:15
Err, none of your examples show how you set the slider itself. Slider is not magically bound to some system values.

You should have something like:
Code (ags) Select

sldMusic.Value = System.Volume;

or
Code (ags) Select

sldMusic.Value = 50;

You should also update the slider every time sound volume is changed by other means (e.g. from script); or, alternatively, when options GUI is about to show up.

E: I want to also point out that "System.Volume" is not the same as "music volume", it's rather "master volume".
Title: Re: How to set default game music volume?
Post by: Gribbler on Fri 11/07/2014 19:08:43
Thanks for the help CW!