I believe the answer to this question to be 'no'. I used an iPhone 4 and the new-to-iOS 4 AVFoundation to experiment, focussing on the AVCaptureDevice class.
I added the following to an application:
NSLog(@"%@", [AVCaptureDevice devices]);
So that asks that all devices that can be used for capturing audio and/or video be listed. Without the headphones plugged in, I get:
(
"Back Camera",
"Front Camera",
"iPhone Microphone"
)
With the headphones plugged in I get:
(
"Back Camera",
"Front Camera",
Headphones
)
So the iPhone microphone drops off the list of available AVCaptureDevices as soon as the headphones become available. To probe this further, I added a quick bit of code to grab the AVCaptureDevice instance for the available audio device and to print its unique ID. For both the device identifying itself as "iPhone Microphone" and the device identifying itself as "Headphones", I got:
com.apple.avfoundation.avcapturedevice.built-in_audio:0
It would seem to me to be obvious that two devices can't have the same unique ID, so clearly it's the same device changing its state. Although AVCaptureDevices have a lot of stuff for setting state, it's limited to visual things like focus, exposure, flash and white balance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…