Game Development Community

Music stopping and restarting

by Vern Jensen · in Torque Game Builder · 12/03/2008 (3:12 pm) · 5 replies

I've noticed in my game that sometimes the background music (played using alxPlay, set to loop) sometimes starts over from the beginning. This happens when lots of enemies get destroyed at once. I'm thinking that all the explosion and alien death sounds are overwhelming the OpenAL system, and when it runs out of free channels and another sound is played, it stops the music and restarts it.

Any way to avoid this, other than installing a 3rd party music system into the C++ engine? (Which I can do if necessary.)

-Vern

#1
12/31/2008 (1:10 pm)
Actually, I *think* I solved the problem by giving the music's AudioDescriptor a different "type" than my other sound effects:

new AudioDescription(AudioLoopingMusic) // For background music
{
   volume   = $gMusicVolume;
   isLooping= true; 
   is3D     = false;
   type     = 12345; 	// Music is a different type than everything else
};
#2
12/31/2008 (3:02 pm)
Hmmm, nevermind, this didn't fix it after all. I'll just install a 3rd party C++ music plugin.
#3
01/02/2009 (12:22 pm)
What 3rd party sound system are you using now?... because i tried to fiddle with various channels for music, SFX and stuff, but had several problems... like certain channels givin no sound, and stuff like that.
#4
01/07/2009 (2:37 am)
I am experiencing the same thing... it seams that it happens when 3-4 sounds are playing at once. Did anyone solve this problem without installing a 3rd party plugin?

Thanks

- Michael
#5
01/07/2009 (3:17 pm)
Ehrlichmann -- I'm not currently using a 3rd party sound system, which is why I'm having the problem. I'm just using looping OGG files I play with alxPlay().

I've seen a 3rd party system in the Resources section which I intent to try.