If you want to loop alot of sounds...like for instance....multiple engines sounds in a race.
First you want to load the sounds in your header.
4 AudioBuffers will allow up to 4 engine sounds.
LOADSOUND "./Media/Engine.wav" , SoundID_Engine , AudioBuffers
In order to loop your sound perfectly, you must know how long it is, and standardize all sound loop sizes!
So with windows, sndrec32.exe in the entertainment menu or from run box, open your engine sound. If the sound is 1.25 seconds long....move the selector to 1.0 seconds and then choose delete after current position. Because we will be looping all looped sounds every one second.
The rule of thumb here is consistancy, so make a standard size of loop, this way you can loop multiple types of sounds with one sound timer routine, in your main loop.
This routine below will only attempt to play a sound every one second, put in main loop:
IF EngineTimer >= 999.0;
EngineTimer = EngineTimer - 999.0;
Now the timer is running, every one second it is going to tell your next function to play all your loops.
PLAYSOUND( SoundID_Engine , 0 , 1.0 )
The sound is being played every second, and your sound is exactly one second long.
Now you dont need SOUNDPLAYING(), which will cause a delay in the audio loop, if you do.
Dont use SOUNDPLAYING() with this loop timer...youll get mixed results.
You can set all your sound buffers up to 4 now.
If your audio loops are smaller than 1 second, like a bullet for instance...
Set the sound to some hundreds of millseconds....for instance, 40% of a second...400ms in sndrec32.exe.
Here you need a second timer:
IF EngineTimer >= 399.0;
EngineTimer = EngineTimer - 399.0;
So, this is why you need to standardize all your sounds....make some loops that are one second long, and a few 400ms long.....and you the above timers to trigger all of them, perfectly timed.
PLAYSOUND( SoundID_Guns , 0 , 1.0 )
I use sndrec32.exe because it is easy and fast, plus you can make sure it is set to 44khz stereo 16 bit.
Futhermore, you can use any software of your choice to make the loop some standard length.
With these timers, i was able to create multiple helicopters engines sounds, and machine guns firing, without interuptions or glitches in the sound loops.
Remember, if your looped sounds arent all the same length, you will need multiple timers to make audiably seamless sound loops.