AudioToolbox and mic callback time
Hi;
I just wrote a modified version of the SpeakHere sample ( a demo application
where you can record your voice and then play it on the iPhone ).
I'm trying to get audio samples from the mic in uLaw format.
The audioFormat definition is:
audioFormat.mSampleRate = 8000.0;
audioFormat.mFormatID = kAudioFormatUlaw;
audioFormat.mFormatFlags = 0;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mBitsPerChannel = 8;
audioFormat.mBytesPerPacket = 1;
audioFormat.mBytesPerFrame = 1;
I also create 3 buffers of 160 bytes ( 20 millis ) each and enqueue them into the previously created Input Queue.
Everything works, but there is a problem on the frequency I get called to the callback.
It was expected to be every 20 millis. But not. The Callback get called
every 70 nanoseconds and the strange thing is that every half a second the callback is delayed 1 second to be called.
Anybody knows the logic behind this behavior ?
I'm missing any configuration or parameter ????
Thanks
|