[Openal] Capture audio, send to output source
Chris Robinson
chris.kcat at gmail.com
Tue Jul 29 19:51:34 PDT 2008
On Tuesday 29 July 2008 07:20:03 pm Darren Rook wrote:
> Thanks for letting me know about the soundcard's update size/window, I
> wasn't aware of this (I guess I was assuming OpenAL would handle
> this). Here's the tricky thing - My microphone is sending me data at
> 8KHz rate - so my output rate is also 8KHz. 4KB buffer is 0.25
> seconds, 8KB is 0.5 seconds. If I need to reduce latency, should I
> increase the microphone's sample rate?
If you're using a low bitrate, you should be able to buffer smaller chunks.
Just make sure you total enough to satisfy OpenAL, instead of however much
you happen to have at a given point.
Unfortunately it's not too easy to figure out just how much OpenAL will want
per update. You can read the ALC_REFRESH context property (
alcGetIntegerv(playbackDevice, ALC_REFRESH, 1, &val); ) and the ALC_FREQUENCY
property to get:
SamplesPerUpdate = Frequency / Refresh
Then multiply that by the capture format sample size (eg. 2 for 16-bit mono),
but this may not be a very accurate total. Using that as the size of each
buffer may work, though.
More information about the Openal
mailing list