Author Topic: How to set default game music volume?  (Read 830 times)

Gribbler

  • Posts: 1,489
  • I'm selling these fine leather jackets.
    • Gribbler worked on a game that won an AGS Award!
    •  
    • Gribbler worked on a game that was nominated for an AGS Award!
How to set default game music volume?
« on: 11 Jul 2014, 15:45 »
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: Adventure Game Studio
  1. 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: Adventure Game Studio
  1. function sldMusic_OnChange(GUIControl *control)
  2. {
  3. //  SetMusicMasterVolume(sldMusic.Value);  
  4. Game.SetAudioTypeVolume(eAudioTypeMusic, sldMusic.Value, eVolExistingAndFuture);

Crimson Wizard

  • Posts: 8,794
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    • Lifetime Achievement Award Winner
    • Crimson Wizard worked on a game that won an AGS Award!
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
Re: How to set default game music volume?
« Reply #1 on: 11 Jul 2014, 15:50 »
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: Adventure Game Studio
  1. sldMusic.Value = System.Volume;
  2.  
or
Code: Adventure Game Studio
  1. sldMusic.Value = 50;
  2.  
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".
« Last Edit: 11 Jul 2014, 15:58 by Crimson Wizard »

Gribbler

  • Posts: 1,489
  • I'm selling these fine leather jackets.
    • Gribbler worked on a game that won an AGS Award!
    •  
    • Gribbler worked on a game that was nominated for an AGS Award!
Re: How to set default game music volume?
« Reply #2 on: 11 Jul 2014, 19:08 »
Thanks for the help CW!