Assign a sound resource to a sync group.


audio_play_in_sync_group(group_index, sound_index);

Argument Description
group_index The group index to assign the sound to.
sound_index The sound index to be assigned to the group.

Returns: Index


With this function you can assign a sound to a previously create sync group. The group index is the value returned when you created the group using the function audio_create_sync_group(), and the sound index is the index of any compressed sound (*.ogg or *.mp3) from the resource tree. This function only adds the sound to the group, but it does not play the sound. The function returns a unique ID value for the sound that has been added (distinct to the sound index) which can then be used as usual in all the other audio functions.


sg = audio_create_sync_group(true);
snd[0] = audio_play_in_sync_group(sg, sound1);
snd[1] = audio_play_in_sync_group(sg, sound2);
snd[2] = audio_play_in_sync_group(sg, sound3);
snd[3] = audio_play_in_sync_group(sg, sound4);
audio_sound_gain(snd[2], 0, 0);
audio_sound_gain(snd[3], 0, 0);
audio_sound_gain(snd[4], 0, 0);

The above creates a new sync group and assigns the index of the group to the variable "sg". Four sounds are then added to the group, with the gain for three of them being set to 0. Finally the sync group is played.

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