I'm using the Audio Unit Framework
to develop a VOIP app on mac os x. There are two audio unit in my program , one is the input-only AUHAL ,the other is the default output unit.
I use the input-only AUHAL
to capture audio. When the sample rate is 44.1khz
, in the AUHAL's callback , the value of inNumberFrames
is 512
which means my program will get 512 frames
audio data from each call AudioUnitRender
. And the value of inNumberFrames
in the default output unit's callback
is also 512
.In this case , every things is fine.
But when I change the sample rate(8khz) both on the input-only AUHAL
and default output unit
, my program isn't working properly.
Because in the output unit's callback , the value of inNumberFrames
became 93
which means the output device need 93 frames
audio data from each call , but the value of inNumberFrames
remain 512
in the AUHAL's
callback. The number of frames didn't match between the AUHAL
and the output unit
.
I can change the AUHAL I/O buffer size
manual by using AudioUnitSetProperty
and slove this problem by using a simple formula with a little error . But I want to know if there are some method to make the AUHAL
adjust its I/O buffer size automatic just like the default output unit
do ?
Thanks & regard