in the apple SpeakHere code example, you can do something like this:
AudioQueueNewInput( &mRecordFormat, MyInputBufferHandler, this , NULL , NULL , 0 , &mQueue)
you can do something in the function "MyInputBufferHandler", for example
[self encoder:(short *)buffer->mAudioData count:buffer->mAudioDataByteSize/sizeof(short)];
encoder function, for example:
while ( count >= samplesPerFrame ) { speex_bits_reset( &bits ); speex_encode_int( enc_state, samples, &bits ); static const unsigned maxSize = 256; char data[maxSize]; unsigned size = (unsigned)speex_bits_write( &bits, data, maxSize ); samples += samplesPerFrame; count -= samplesPerFrame; }
This is a general idea. Of course, this is difficult, but you can see some kind of open source VOIP, maybe it can help you. good luck.
source share