views:

72

answers:

3
(AudioQueueNewInput(
                                      &mRecordFormat,
                                      MyInputBufferHandler,
                                      this /* userData */,
                                      NULL /* run loop */, NULL /* run loop mode */,
                                      0 /* flags */, &mQueue), "AudioQueueNewInput failed");

Can someone tell me what the "this" (3rd parameter) means here? And also, what are the values accepted beside "this"? I'm new to iphone programming...

+1  A: 

It's a pointer to something (in this case the instance object of the current class) that gets passed back to you when the audio callbacks are fired, as they'd otherwise have no idea of where the callbacks are being fired from.

coob
+1  A: 

That's simply some context you can use to tell several audion queues apart in the callback. Imagine you create two queues and want to use the same callback function for them. When the callback is invoked, how do you know which of your two queues did call it? That's exactly what the userData parameter is for. You pass any kind of data you want here and the queue will present them back to you in the callback. If you don't understand this, you don't need it and can safely pass NULL here.

zoul
A: 

Thanks zool and coob. I thought it was AudioQueueNewInput for changing the input source in the Speak Here sample code from apple. Can someone help me in finding the recording input source?

Actually it is recording from the device mic, I need it to record the audio playing on the device.

okayasu
You probably need to ask that as a separate question.
hotpaw2