Hi,
I have an application where user can record sound and also play the sound either in the speaker or the ear piece. To route the audio I set kAudioSessionProperty_OverrideAudioRoute in the following way:
if(loudSpeakerOn) {
audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
}
else {
audioRouteOverride = kAudioSessionOverrideAudioRoute_None;
}
AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
I should also make sure that when user switches on/off the mute/vibrate switch the sound should mute/unmute. For this I set the following property
SInt32 ambient = kAudioSessionCategory_AmbientSound;
if (AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof(ambient), &ambient)) {
NSLog(@"*** Error *** could not set Session property to ambient.");
}
Now, the problem is when I set the Ambient property, Audio Route and Audio recording stops working.
How can I get all of these working together?
Thanks!