How to set default game music volume?

Started by Gribbler, Fri 11/07/2014 15:45:47

Previous topic - Next topic

Gribbler

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
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
function sldMusic_OnChange(GUIControl *control)
{
//  SetMusicMasterVolume(sldMusic.Value);  
Game.SetAudioTypeVolume(eAudioTypeMusic, sldMusic.Value, eVolExistingAndFuture);


Crimson Wizard

#1
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

sldMusic.Value = System.Volume;

or
Code: ags

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".

Gribbler


SMF spam blocked by CleanTalk