AudioQueueServices - AudioQueueNewInput
(AudioQueueNewInput(
&mRecordFormat,
MyInputBufferHandler,
this /* userData */,
NULL /* run loop */, NULL /* run loop mode */,
0 /* flags */, &mQueue), "AudioQueueNewInput failed");
有人能告诉我这里的“this”(第三个参数)是什么意思吗?另外,除了“this”之外,还接受哪些价值观?我是 iPhone 编程新手...
(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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这只是一些上下文,您可以使用它来区分回调中的多个三极管队列。想象一下您创建了两个队列并希望为它们使用相同的回调函数。当调用回调时,您如何知道两个队列中的哪一个调用了它?这正是 userData 参数的用途。您可以在此处传递任何类型的数据,队列将在回调中将它们呈现给您。如果你不明白这一点,你就不需要它,可以在这里安全地传递 NULL。
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.
它是一个指向某些东西(在本例中是当前类的实例对象)的指针,当音频回调被触发时,该指针会传回给您,否则他们不知道回调是从哪里触发的。
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.