View Full Version : Play buffer simultaneously

Harry Hunt
04-11-2003, 12:42 PM
Howdy! This may sound like a stupid question, but I'll ask it anyway. I have a classic DirectSound setup with a number of buffers. One of them is a "click" kind of sound that I play whenever the player mouse-overs over a button. Now this sound is played a lot because there are a lot of buttons that are close to each other. So it often happens that "play" is executed for a buffer that is still playing. Whenever that happens, the call to "play" is simply ignored and I don't hear anything. If I call "stop" first and then "play" it works fine but the sound effect are chopped of.
So my question is: How do I play the same sound buffer again and again without having to stop it when it's still playing?

04-11-2003, 11:40 PM
Aaarghh! I really need to brush up on my DirectSound knownledge again.
Can't you have two (or more?) buffers and play the second click in the second buffer?

Harry Hunt
05-11-2003, 06:46 AM
Yeah, that's what I ended up doing. Thanks a lot anyway!
Didn't think there was no way to play the same buffer several times simultaneously but i guess that's just how it is...

07-11-2003, 10:20 AM
Hmm... this idea may sound a bit exccessive, but could you not 'mix in' the click sound right into the buffer? Or have a pre-buffer that does this mixing? You may end up using some pretty low-level(in-line ASM) to get the job done fast, but it may allow you to keep to the one sound buffer.

Only question is, can it be done fast enough?

08-11-2003, 12:59 AM
I was just researching this myself! Since DirectSound can be hardware accelerated, it is fastest to create a buffer each time you want to play a sound because directsound will just send the sound into the soundcard for mixing if the soundcard supports it. Less CPU = Good.

09-11-2003, 02:20 PM
Less CPU work == More soundcard driver bugs :lol: