DJ, sorry if this question has already been covered... I missed it, if it was. I've been out of the loop for a while.
Anyway, I'm wondering what is the best approach to use when enabling/disabling an infinitely looping sound? It's a retro game I've been playing with, and the sound is used for a space-ship thruster. When the thrust key is pressed, the volume will be set using distance, when it isn't pressed, the volume is set to 0. I'm getting a popping sound whenever I do this, and I wonder if there is a better approach? At first, I tried to play/stop the sound, but it had the popping artifact, so I tried switching to this method, and the popping persists. It might just be that my PC has a weird driver/hardware. Thanks for any tips or advice. This is the first time I've tried to use FBSound for a complete game.
Code: Select all
if .thrust>0 then
dim as vec2f vec = .dirVec*-1
.prt->spawn_thrust( .model(0).tLines(2).p1+.p, .model(0).tLines(1).p1+.p, .model(0).tLines(3).p1+.p, vec*50, PARTICLE_ENUM.THRUST, fTime + .5 )
fbs_Set_SoundPan (sound(2), -((cam.p.x-player.p.x)+320)/320)
fbs_Set_SoundVolume( sound(2), 100-(player.p.dist(cam.transP)/SOUND_FALLOFF_FACTOR) )
fbs_Set_SoundVolume( sound(2), 0 )