I found the answer to my question. It turns out that if your application records and plays, the iphone will by default reroute your playback to the top speaker (the one by your ear), rather than to the speaker at the bottom of the phone. This was the reason for the low volume. If you add the following code, you can force the iphone to route the audio to the bottom speaker.
UInt32 doChangeDefaultRoute = 1;
AudioSessionSetProperty (
kAudioSessionProperty_OverrideCategoryDefaultToSpe aker,
sizeof (doChangeDefaultRoute),
&doChangeDefaultRoute);
You also have to include the audiotoolbox framework. The avfoundation framework by itself will not allow this code to work.
No comments:
Post a Comment