开发者

iOS SDK - how the iphone audio jack interacts with the attached cable?

I开发者_如何学C seem to be getting several values from kaudiosessionproperty_audioroute property on the iPhone. Such as :

ReceiverAndMicrophone
HeadsetInOut
HeadphonesAndMicrophone
SpeakerAndMicrophone

How does the iPhone (iPod?) know what property to choose? What does each property mean on the perception of the microphone on the iPhone?

Many Thanks!


The key to understanding this is knowing what the words mean. I don't know of a good dictionary in the docs, but some of the definitions are scattered through the docs (including the Audio Session Programming Guide). Others, you just need to know how headsets work.

  • Receiver: "the small speaker you hold to your ear when on a phone call"
  • Headset: A 3-conductor plug in the headset jack (Left, Right, Microphone + Ground).
  • Headphones: A 2-conductor plug in the headset jack (Left, Right + Ground)
  • Microphone: The iPhone's microphone (at the base of the unit)
  • Speaker: The iPhone's "loud" speaker (at the base of the unit)

So if you've plugged in "headphones" (earbuds with no microphone), that's HeadphonesAndMicrophone. ReceiverAndMicrophone vs. SpeakerAndMicrophone is a software configuration setting (e.g. pressing the "Speaker" button in Phone.app).

You can tell how many conductors are on a headset jack by looking at the black bands that separate the channels. A stereo headphone jack has two black bands. A headset jack (with microphone) has three. This is how the device can tell which one is plugged in. It just checks for continuity between one of the audio channels and the microphone input. If there's a short, then that means it's a headphone. If it's open, then it's a headset.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜