use rear microphone of iphone 5

core-audio, ios, iphone

Solution

in apple developer library click here

you can see a specific method

struct AudioChannelLayout {
   AudioChannelLayoutTag     mChannelLayoutTag;
   UInt32                    mChannelBitmap;
   UInt32                    mNumberChannelDescriptions;
   AudioChannelDescription   mChannelDescriptions[1];
};
typedef struct AudioChannelLayout AudioChannelLayout;

you can change AudioChannelDescription to 2 for using secondary microphone

Problem

I have used to following code the stream the i/o of audio from microphone. What I want to do is want to select the rear microphone for recording. I have read that setting kAudioSessionProperty_Mode to kAudioSessionMode_VideoRecording can do the work but I am not sure how to use this with my code. Can any one help me in successfully setting this parameter. I have these lines for setting the property ``` status = AudioUnitSetProperty(audioUnit, kAudioSessionProperty_Mode, kAudioSessionMode_VideoRecording, kOutputBus, &audioFormat, sizeof(audioFormat)); checkStatus(status); ``` but its not working.

Original source