• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows Sound Emitters not working (sometimes)

Kyon

Member
Why do my audio emitters stop working?

So I am like spawning objects on the right side of the screen, they move to the left, and if they are on the left they destroy itself and recreate the same object on the right side of the screen.
This works.
on create event of this object I have this:
Code:
ae    = audio_emitter_create()

audio_emitter_falloff(ae,100,1000,1);
audio_emitter_position(ae,x,y,0);

snd = choose(sfxAmbi1,sfxAmbi2,sfxAmbi3,sfxAmbi4,sfxAmbi5);

wsp = audio_play_sound_on(ae,snd,true,5);
on step event of that object this:
Code:
x-=.5;

audio_emitter_position(ae,x,y,0);




if (x < oControl.cam_x - 300){
audio_stop_sound(wsp);
audio_emitter_free(ae);
instance_create_depth(oControl.cam_x + oControl.cam_w + 300+ irandom(64), oPlayer.y - 25 + irandom(50),depth,oEmitter2);
instance_destroy();
}
As you see, it creates the object with some random values and free's it's emitter
now this works at first, but after maybe 3 times it just stops.
the audio stops.
as in, the emitter audio.
(also, the instances are being created constantly and moving right next to the listener. the audio problem is really in the emitter part, and I wonder what's happening. I even spotted it stopped mid-way, like mid sample in the middle of the listener position, just random)


https://we.tl/t-1Wtq01c00x
here is a .exe
Sometimes it takes a while before you hear the audio dissapear / glitch (sometimes it glitches like you hear half a second of audio suddenly)



Kyon.
 
Last edited:

Kyon

Member
Update my post with something I typed in the discord, also added an .exe so you can see what I mean
 
Top