0
(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...

awlcs
  • 606
  • 2
  • 13
  • 31

2 Answers2

1

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.

Alastair Stuart
  • 4,165
  • 3
  • 36
  • 33
1

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
  • 102,279
  • 44
  • 260
  • 354