6

I'm messing around with Audio Session Services. I'm trying to control the audio routes setting AudioSessionSetProperty: kAudioSessionProperty_OverrideAudioRoute as kAudioSessionOverrideAudioRoute_Speaker.

The problem is that it changes the route both for input and output. What I want is to have input set from headset's mic, and output by speakers.

Any ideas?

Ty!

gotnull
  • 26,454
  • 22
  • 137
  • 203
Martha
  • 1,070
  • 1
  • 12
  • 29
  • I'm trying to do the same thing. Was reading up and came across this. http://stackoverflow.com/questions/1064846/iphone-audio-playback-force-through-internal-speaker Is this what you have tried? – Namratha Aug 10 '11 at 09:46
  • Actually that is what ive tried. I still couldnt find the way to separate speaker and mic routes. Pls let me know if you make it. – Martha Aug 12 '11 at 15:09

1 Answers1

3

You can do this in iOS 5 with the properties:

kAudioSessionProperty_InputSource 
kAudioSessionProperty_OutputDestination 

For the possible values (what sources \ destinations are available on the device) use AudioSessionGetProperty with the properties:

kAudioSessionProperty_InputSources
kAudioSessionProperty_OutputDestinations

For iOS 3.1+, I assume you're using the PlayAndRecord audio session category - you might want to try setting kAudioSessionProperty_OverrideCategoryDefaultToSpeaker to true. For instance,

UInt32 defaultToSpeaker = 1;
status = AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,                        
                                sizeof (defaultToSpeaker),                                   
                                &defaultToSpeaker                               
                                );

Might not be exactly what you're looking for, but I don't think you can come closer in < iOS 5.

gf1223
  • 54
  • 2
  • 3
    Unfortunately, kAudioSessionProperty_InputSources is for **USB audio accessory**. So it not works with my headset. – adruzh Oct 07 '11 at 06:57
  • I have seen this solution several times but I just do not know where to place that piece of code. Can Someone please tell me? – meda Apr 30 '13 at 22:48