Skip to main content
gamedev.net
🔒 Locked

DirectSound help!

Started by BradDaBug 2 replies 200+ views
Original Post
BradDaBug
BradDaBug
I''ve got DirectSound all set up and it plays sounds fine, but it doesn''t work like I want it. Lets say I have a gun, shooting pretty quickly. Each time it shoots a bullet, i want it to go POW!, but the sound effect POW! is half a second long. It won''t play POW! more than once! It waits until POW! has finished playing before it plays it again! So several bullets coulda been shot before it goes POW! again. How do I make it go POW! for each bullet?
I like the DARK layout!
MarkyD
MarkyD
Are you sure that you are usind several sound buffers? If you are only using 1, then calling Play will play the sound, and subsequent calls will do nothing, unless the sound has finished playing.

~ There''s no substitute for failure ~
BradDaBug
BradDaBug
so, if the sound is say .5 seconds long, and the fire rate of the gun is say 5 times per second, I have to make sure theres at least 4 buffers, each with the POW! sound?
I like the DARK layout!
MarkyD
MarkyD
It depends on the rate of the sound, and how long the sound is.

So if the rate of each shot was half a second, and each POW! lasted for 2 seconds, there is at most going to be, at any one time, a total of 4 sounds playing - one for each POW!.

There is a DirectSound function called DuplicateSoundBuffer. What you should try is having an array of sound buffers, load the sound into the first, and call that function for the rest.

I'm writing this from memory, so if anyone thinks I missed something, say so.

~ There's no substitute for failure ~

Edited by - MarkyD on January 6, 2002 10:20:33 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.