I use this sort of method - ensures that no more than 5 explosions (0-4) can be playing at once. If it reaches a point where explosions are playing on all 5 'channels' (elements of the Explosion array), then the oldest one is stopped. Funny, took longer to explain it than it did to write the code that does it. :)
Dim Explosion%(4) Global ExplosionPtr% Function PlayExplosion() ExplosionPtr = ExplosionPtr + 1 If ExplosionPtr > 4 Then ExplosionPtr = 0 If ChannelPlaying(Explosion(ExplosionPtr)) StopChannel Explosion(ExplosionPtr) EndIf Explosion(ExplosionPtr) = PlaySound(sndExplosion) End Function