audio_group_set_gain

Set the gain for all audio assigned to the given group.

Syntax:

audio_group_set_gain(groupID, volume, time);


Argument Description
groupID The index of the audio group to stop (as defined in the Global Game Settings Audio Groups Tab)
volume The final value for the group volume.
time The length of the change in gain in milliseconds.


Returns: N/A


Description

With this function you can fade a group of sounds in or out over a given length of time, or it can be used to set the group gain instantly. The time is measured in milliseconds, and the function requires that you input a final level of gain for the group to have reached by the end of that time. This gain can be between 0 (silent) and 1 (full volume) and the scale is linear, such that a value of 0.5 would be half volume. To instantly change the gain, simply set the time argument to 0.


Example:

if keyboard_check_pressed(vk_space)
   {
   audio_group_set_gain(audiogroup1, 0, 5000);
   }

The above code checks for the "space" key and then fades all the audio for "audiogroup1" down to 0 over 5 seconds.


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