Sign in to follow this  

DirectX DirectSound

This topic is 3631 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
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

This topic is 3631 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this