1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GM:S 1.4 Audio emitter sound problem

Discussion in 'Programming' started by Holy Moly, Sep 2, 2017.

  1. Holy Moly

    Holy Moly Guest

    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?
  2. obscene

    obscene Member

    Jun 21, 2016
    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;
  3. Smiechu

    Smiechu Member

    Jul 14, 2017
    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...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice