• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

Legacy GM Any way to check if any sound from an audio group is playing?

For my game I have all my voice overs in an audio group called audio_vo, but I need to check if any of the sounds in the audio group are playing. I tried audio_is_playing(audio_vo), but it doesn't seem to work.
I suppose I could put all the voice lines in an array and check them all in a loop or something, but I'm wondering if there's another way.

Any help is appreciated!
 

Dmi7ry

Member
Create an array of all sounds of the group, and then check each of them with audio_is_playing.
Something like this:
Code:
all_sounds = array_create_ext(snd_win, snd_lose, snd_click, snd_start);
Code:
/// audio_is_playing_group(array_of_sounds)
var data = argument0;
for (var i=0; i<array_length_1d(data); i++)
{
    if audio_is_playing(data[i]) return true;
}

return false;
Code:
/// array_create_ext(value1, [value2, ...])

var data = array_create(argument_count);

for (var i=0; i<argument_count; i++)
{
    data[i] = argument[i];
}

return data;
 
yeah that's what I ended up doing. I was wondering if there was some simpler method that didnt involve an array and rather checking the whole group in a single function. Thanks though
 

Dmi7ry

Member
yeah that's what I ended up doing. I was wondering if there was some simpler method that didnt involve an array and rather checking the whole group in a single function. Thanks though
Ask YoYo for this feature (audio_group_get_ids or something like this), maybe it will happen (but only for GMS2, of course).
 
Top