如何收听该属性?

发布于 2024-08-31 01:12:30 字数 595 浏览 1 评论 0原文

@constant       kAudioSessionProperty_AudioInputAvailable 
                    A UInt32 with a value other than zero when audio input is available.
                    Use this property, rather than the device model, to determine if audio input is available.
                    A listener will notify you when audio input becomes available.  For instance, when a headset is attached
                    to the second generation iPod Touch, audio input becomes available via the wired microphone. 

那么,如果我想收到有关 kAudioSessionProperty_AudioInputAvailable 的通知,我该怎么做?

@constant       kAudioSessionProperty_AudioInputAvailable 
                    A UInt32 with a value other than zero when audio input is available.
                    Use this property, rather than the device model, to determine if audio input is available.
                    A listener will notify you when audio input becomes available.  For instance, when a headset is attached
                    to the second generation iPod Touch, audio input becomes available via the wired microphone. 

So, if I wanted to get notified about kAudioSessionProperty_AudioInputAvailable, how would I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挖个坑埋了你 2024-09-07 01:12:30

您可以这样设置侦听器:

AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, myCallback, NULL);

您必须定义一个回调函数,每当值发生变化时就会调用该函数:

void myCallback(void* inClientData, AudioSessionPropertyID inID, UInt32 inDataSize, const void* inData)
{
    printf("value changed\n");
}

You set up the listener like this:

AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, myCallback, NULL);

You have to define a callback function which gets called whenever the value changes:

void myCallback(void* inClientData, AudioSessionPropertyID inID, UInt32 inDataSize, const void* inData)
{
    printf("value changed\n");
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文