This has been annoying me for about 3 hours now. I know there are other ways to play sounds, but this should work right?
Here's an exe with source and the sound fx: http://www.greyaliengames.com/misc/soundtest.zip [~500K)
What happens on my PC is that if I press Z twice then X, the X sound cuts off the Z sound EVEN THOUGH IT'S ON A DIFFERENT CHANNEL! What's going on? Naturally I'm very keen to hear if this is just happening on my PC or all PCs.
Actually, I am getting a worse, but related, problem in my mini game where after a couple of shots, my ship stops making firing noises at all even though it doesn't mix channels with the explosions. There really is no explanation except that using Channels in this way is Bugged in BMax, or my sound card (SB Audigy 2) is crazy, or I'm willing to accept there is something wrong with the above code of course, that would be the best thing :-)
oh and the same thing occurs if I change the code like this:
and naturally it works fine like this:
but I don't want to do that as it wastes sound channels as a new one is made each time.
Here's an exe with source and the sound fx: http://www.greyaliengames.com/misc/soundtest.zip [~500K)
Strict Graphics 800,600,0 Global Explosion:TSound = LoadSound("explosion.wav") Global Fire: TSound = LoadSound("fire.wav") Global FChannel:TChannel = AllocChannel() Global EChannel:TChannel = AllocChannel() Repeat Cls DrawText("Press Z twice then quickly press X.",0,0) DrawText("The explosion noise is cut off.",0,15) DrawText("After that it works fine!",0,30) If KeyHit(KEY_Z) Then PlaySound(explosion,EChannel) EndIf If KeyHit(KEY_X) Then PlaySound(Fire,FChannel) EndIf Flip Until KeyHit(KEY_ESCAPE)
What happens on my PC is that if I press Z twice then X, the X sound cuts off the Z sound EVEN THOUGH IT'S ON A DIFFERENT CHANNEL! What's going on? Naturally I'm very keen to hear if this is just happening on my PC or all PCs.
Actually, I am getting a worse, but related, problem in my mini game where after a couple of shots, my ship stops making firing noises at all even though it doesn't mix channels with the explosions. There really is no explanation except that using Channels in this way is Bugged in BMax, or my sound card (SB Audigy 2) is crazy, or I'm willing to accept there is something wrong with the above code of course, that would be the best thing :-)
oh and the same thing occurs if I change the code like this:
If KeyHit(KEY_Z) Then EChannel = PlaySound(explosion,EChannel) EndIf If KeyHit(KEY_X) Then FChannel = PlaySound(Fire,FChannel) EndIf
and naturally it works fine like this:
If KeyHit(KEY_Z) Then EChannel = PlaySound(explosion) EndIf If KeyHit(KEY_X) Then FChannel = PlaySound(Fire) EndIf
but I don't want to do that as it wastes sound channels as a new one is made each time.