What is the simplest way to do ----
(1) Play output to default speaker while a a gadget to swipe cards (like square) is plugged in to
(2) Record with AVAudioSessionPortBuiltInMic; & playback throgh default speaker
(3) Switch/ensure that the gadget is still reading info from the card through AVAudioSessionPortHeadsetMic
(4) Switch back to step-2.
Step 3 may use a "swipe-class" and the rest of the steps all use a "playRecord-Class"
Some more details -----------
I went through that --- "Audio Session Programming Guide". It is presumed that a "Card-Swiping Gadget" is plugged into the iOS device, before the app is launcedand is kept plugged in.
So, no hardware route changes.
To set the output I use ---
[myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDefaultToSpeaker error:&errorAudioCategory];
For me it is not clear from the documentation --- the pros & cons of AVAudioSessionCategoryOptionMixWithOthers
I was hoping that there is another "option" to select the input to be either "AVAudioSessionPortHeadsetMic" or "AVAudioSessionPortBuiltInMic"; just like Defaulting to Speaker.
Also, there are some fixed hardware inputs iOS devices.
Needed clear sample code how to set input as one of the three --- AVAudioSessionPortLineIn; AVAudioSessionPortBuiltInMic; ;
The other problem is to switch from the ViewController that plays & record Audio to another view controller that can use AVAudioSessionPortHeadsetMic to complete the card-swiping activities and switch back to the first ViewController.
More clear documentation and more sample code would cut down the development time.
Need a quick way to resolve this!
Thanks.