怎么听那个房产?

时间:2010-05-02 13:32:49

标签: iphone audio audiosession

@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的通知,我该怎么做?

1 个答案:

答案 0 :(得分:2)

您可以像这样设置监听器:

AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, myCallback, NULL);

您必须定义一个回调函数,只要值发生变化就会调用它:

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