GameMaker Question about audio_play_sound volume stacking

Jihl

Member
Hello!

My question is in regard of high volume when you play an audio repeatedly...
In my game you can kill lots of monsters, and the cut sound effect, hit sound effect and dying sound effect all get on eachother making a really big mess with the volume...

My solution was to make global variables to count how many times the sound has played over a short period, so it can only play, let's say like 3 times if they go out instantaneously. Then the counter goes down. All of this is to get myself not hearing the same sound 15 times if I kill 15 monsters at the same exact moment.

But is there another way to achieve this without using global variables?

Thank you!
 

Nidoking

Member
Have you looked into audio_channel_num? That sets a cap on the total number of sounds that can play at once. Just make sure you set the priorities of all of the sounds so you don't cut out the music or really important effects.
 

Jihl

Member
I see, thanks for the answers! Sadly the audio_channel_num is not the thing that I need. I will make my own way through code
 

TsukaYuriko

☄️
Forum Staff
Moderator
To avoid "ghosting" of sounds, I keep my own lists of active sound instances (which are removed once they stop playing), and each list (one per sound) has its own limit of how many instances can be active at a time. If a new one is to be played and the maximum has already been reached, the oldest one is stopped and removed, then the new one is played. This way, there will be, say, at most three explosions audible at the same time, but each new one will definitely be audible and not just randomly remain silent.
 
Top