2010-05-02 72 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"); 
}