Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 怎么听那个属性?_Iphone_Audio_Audiosession - Fatal编程技术网

Iphone 怎么听那个属性?

Iphone 怎么听那个属性?,iphone,audio,audiosession,Iphone,Audio,Audiosession,因此,如果我想得到关于kAudioSessionProperty\u AudioInputAvailable的通知,我该如何做?您可以这样设置侦听器: @constant kAudioSessionProperty_AudioInputAvailable A UInt32 with a value other than zero when audio input is available. Use th

因此,如果我想得到关于kAudioSessionProperty\u 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. 
您必须定义一个回调函数,该函数在值更改时被调用:

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