Legacy GM Audio emitter sound problem


Holy Moly

I have set 3d sounds to some bullets in my game, so the sound has falloff and changes it's speaker orientation depending on the listener (player) position. Those bullets make a sound as they travel. At this point, the 3d sound works perfectly.

However, when a bullet is destroyed, I want it to a make a different sound with the same falloff and sound orientation properties. The problem is that if I don't free each bullet's emitter on destroy event, it will result on a memory leack; and freeing a bullet's emitter seems to not be allowing me to play the "bullet destroy sound effect". I had thought on freeing the bullet's emitters on room end, but if the bullet spawner makes too many bullets before room end, it will also result on a memory leack.

Is there a way to don't stop an object's last emitted sound after that emitter was freed?


Nope. Personally I have a custom script for these situations which just calls audio_play_sound_at and uses my global falloff settings so it will match up to the sounds of your emitters.

var s=audio_play_sound_at(argument0,argument2,argument3,1,global.falloff_ref_dist,global.falloff_max_dist,global.falloff_factor,false,1);
return s;


In destruction event you can "send" the ID of sound emmiter to your "obj_game" or whatever you have for governing the general things in your game...
Game event would store the Id's in a ds_queue... Than you need to make some conditions for cleaning the queue...
For example if queue count is 100 - destroy 20 ID from the front of the queue...