I need to capture record buffer samples for a voice app. The samples need to be 20ms, however using the polling technique shown in the examples it appears getrecordposition only updates every 42ms worth of samples.
Is there a way to have it update getrecordposition at a finer granularity? say every 20ms worth of samples.
If not is there another way to get the recorded data say using a callback instead of getrecordposition? Like setting pcmreadcallback on the sound, or does that only work for playback?
- wolfmanjm asked 8 years ago
That’s actually the driver doing that. It isn’t random, its just based on the block size internal to the driver depending on sample rate.
On windows for example, XP uses directsound and we are just returning the cursor position directly from the driver with IDirectSoundBuffer::getCurrentPosition or the record equivalent.
Using the recording example it seems on Linux I get a delta between updates of the record position at exactly 42.62ms worth of samples while polling every 10ms, at least it is regular.
On WinXP using either directsound or windows MM it varies between 10ms and 40ms randomly. This is not very good when you need to send regular 20ms packets every 20ms for voice. This introduces a significant amount of jitter which will get even worse when the packets are sent over the internet.
Is there anyway to make this more regular on Windows?
- wolfmanjm answered 8 years ago
Please login first to submit.