Jump to content
  • Advertisement
Sign in to follow this  
MoLaw

DirectX DirectSound

This topic is 3939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I am creating a program using DirectSound to capture audio from an external device. I tried to start recording when notified by the external device but I could never get the first part of the audio transmission so I decided to record constantly polling the CaptureBuffer.GetCurrentPosition. I feel that this will work but I am having trouble figuring out the CaptureBuffer.Read. I figured I would capture the GetCurrentPosition when the audio starts and the again when the audio stops figure out the NumberOfBytesToRead and pass the info into the CaptureBuffer.Read Method. I am having trouble retrieving the NumberOfBytesToRead information. I tried to subtract the two GetCurrentPosition values but that is not working due to the buffer being circular (Which is confusing me also). I understand that the buffer is circular but how big is it and can I change the buffer size? When I poll the GetCurrentPosition every .5 seconds it seems that the buffer is only a couple of seconds long. To sum it up I just need to know how to get the NumberOfBytesToRead from two GetCurrentPosition values. I appreciate all the help. MoLaw

Share this post


Link to post
Share on other sites
Advertisement
How about this?

if (current_position >= last_position) {
num_bytes_to_read = current_position - last_position;
} else {
num_bytes_to_read = current_position + (size_of_buffer - last_position);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!