【问题标题】:How to listen to that property?如何收听该属性?
【发布时间】:2010-05-02 13:32:48
【问题描述】:
@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 的通知,我该怎么做?

【问题讨论】:

    标签: iphone audio audiosession


    【解决方案1】:

    你这样设置监听器:

    AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, myCallback, NULL);
    

    你必须定义一个回调函数,只要值改变就会被调用:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-05
      • 2019-09-29
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 2017-11-17
      • 1970-01-01
      相关资源
      最近更新 更多