开发者

Audio Session Services: kAudioSessionProperty_OverrideAudioRoute with different routes for input & output

开发者 https://www.devze.com 2023-03-06 16:09 出处:网络
I\'m messing around with Audio Session Services. I\'m trying to control the audio routes setting AudioSessionSetProperty: kAudioSessionProperty_OverrideAudioRoute as kAudioSessionOverrideAudioRoute_Sp

I'm messing around with Audio Session Services. I'm trying to control the audio routes setting AudioSessionSetProperty: kAudioSessionProperty_OverrideAudioRoute as kAudioSessionOverrideAudioRoute_Speaker.

The pr开发者_如何学Pythonoblem is that it changes the route both for input and output. What I want is to have input set from headset's mic, and output by speakers.

Any ideas?

Ty!


You can do this in iOS 5 with the properties:

kAudioSessionProperty_InputSource 
kAudioSessionProperty_OutputDestination 

For the possible values (what sources \ destinations are available on the device) use AudioSessionGetProperty with the properties:

kAudioSessionProperty_InputSources
kAudioSessionProperty_OutputDestinations

For iOS 3.1+, I assume you're using the PlayAndRecord audio session category - you might want to try setting kAudioSessionProperty_OverrideCategoryDefaultToSpeaker to true. For instance,

UInt32 defaultToSpeaker = 1;
status = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,                        
                                sizeof (defaultToSpeaker),                                   
                                &defaultToSpeaker                               
                                );

Might not be exactly what you're looking for, but I don't think you can come closer in < iOS 5.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号