audio_master_gain

Set the global sound and music volume.

Syntax:

audio_master_gain(gain);


Argument Description
gain Value for the global volume (0 to 1).


Returns: N/A


Description

With this function you can set the absolute value for the global volume of all sounds and music. It is based on a linear scale from 0 (silent) to 1 (full volume) and will affect the relative volume of all sounds and music played from within your game.


Example:

if keyboard_check(vk_up)
   {
   if vol < 1 vol += 0.05;
   audio_master_gain(vol);
   }
if keyboard_check(vk_down)
   {
   if vol > 0 vol -= 0.05;
   audio_master_gain(vol);
   }

The above code checks for key-presses of the up and down arrow keys, which then increase or decrease the variable "vol". This variable is then used to set the global gain of all sound and music in the game.


Back: Audio
Next: audio_set_master_gain
© Copyright YoYo Games Ltd. 2018 All Rights Reserved