Legacy GM No function for audio groups?



No function for audio groups?

I need a way to check if a particular sound ( e.g. scream_sound) belongs to a particular audio group ( e.g. Voices), using code. I know that you put sounds into audio groups using the resource section, but do I always need to go there if I want to check which sounds belong where? A function would help much.

I secondly need a way to check if any sound of a particular audio group is playing. I need not specify the sound's index; I should just know whether any sound of that audio group is playing. I need this so that I can say: if any sound of Group 1 is playing, stop all sounds of Group 2.

Now that GameMaker:Studio 1 lacks these functions, what reckon ye that I can do?

For the first one: I have no idea.

For the second:
Use arrays? I could make an array representing a group, and input sounds as its positions. E.g. voices_group[0]= scream_sound;
voices_group [1]= (another sound); etc.
And if I want to check if any sound is playing, I run a for-loop from 0 to (number of sounds-1).

I'm confused and need help. Or maybe there's no way?


There's no built-in way, but you know that. Personally, I feel you shouldn't need that kind of function as it kind of defeats the purpose of audiogroups. When your player starts a new level or enters an area you should probably load up all the audiogroups that are needed for that area and unload the rest, as well as any other loading/unloading of other stuff you need/don't need. That would be the "standard" practice anyway.

Apart from that, you would have to make your own way to track that, either by building a list or array as you mentioned or you could also use a naming convention...

// example

... whereas 01 is the name of the audiogroup / level / etc. Then at the start of the game you could automatically build your lists by using audio_get_name and string_pos or something similar.

I guess you COULD write a script that plays a sound, checks to see if it's playing and if not, load the audiogroup for it (using your array/list ) and retry, but that's going to be messy and probably will cause hiccups in the audio and dropped frames.