sound_volume(index, value);
Argument | Description |
---|---|
index | The index of the sound to change the volume of. |
value | The new volume from 0 to 1. |
Returns: N/A
With this function you can change the volume of the given sound.
This will change the volume for all further instances where the
indexed sound is played and the volume can be set to a value
between 0 (silent) and 1 (full volume), with a value of 1 being the
default volume for the sound unless it has been previously changed
in the sound
resource. The volume scale is logarithmic in nature, so a
volume of 0.5 is not half volume, as illustrated by the
image below:
if keyboard_check_pressed(vk_add)
{
if vol < 1 vol += 0.1;
sound_volume(global.Music, vol);
}
The above code checks for a key press and when it detects one it raises the volume (to a maximum of 1) of the sound indexed in the global variable "Music".