2010-05-02 50 views
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的通知,我该怎么做?如何收听该房产?

回答

2

你建立这样的监听器:

AudioSessionAddPropertyListener(kAudioSessionProperty_AudioInputAvailable, myCallback, NULL); 

你必须定义它被调用的回调函数,每当价值的变化:

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