Use the built-in microphone if a headset is connected

I play AudioSessions on iOS, and I want to use the iphone's built-in microphone as an audio input route, even if an external headset (including a microphone) is connected. I can determine if a headset is connected using the following code:

CFStringRef route; UInt32 propertySize = sizeof(CFStringRef); AudioSessionInitialize(NULL, NULL, NULL, NULL); AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &propertySize, &route); if((route == NULL) || (CFStringGetLength(route) == 0)){ // Silent Mode NSLog(@"AudioRoute: SILENT"); } else { NSString* routeStr = (NSString*)route; NSLog(@"AudioRoute: %@", routeStr); NSRange headsetRange = [routeStr rangeOfString : @"Headset"]; if(headsetRange.location != NSNotFound) { NSLog(@"Headset") //route Audio IN to built-in mic. } .... more code 

So any ideas how to do this?

+1
ios objective-c iphone
source share

No one has answered this question yet.

See similar questions:

8
IOS SDK mute internal microphone
3
Choose between built-in microphone and headset in iOS

or similar:

14
How to install an iOS application to use USB audio for input and output to internal speakers
8
AVAudioSession / Audio Session Services Output
3
Choose between built-in microphone and headset in iOS
2
Remote iPhone I / O Issues
2
(iPhone) -How to use the built-in microphone if a headset is connected?
one
Does AVAudioSession automatically redirect iPhone audio?
one
Stereo playback is converted to mono (iPad only) even when using stereo headphones
one
Cordoba detects sound switching mode - built-in speaker for bluetooth speaker
one
Play sound when headset is connected
0
MPMusicPlayerController kills RemoteIO on iPhone

All Articles