I have a Cocos2D(Box2D) project that contains AVAudioRecorder object (Microphone Listening). I've not problem with audio in iPhone 4, but the audio volume in iPhone 3G is very low! I did increase device volume to the max volume but the audio volume still not changed.
I found the problem! The audio volume is low cause audio played in phone call speaker (not main speaker).
To play audio in main speaker we need this code:
UInt32 doChangeDefaultRoute = 1;
AudioSessionSetProperty(
kAudioSessionProperty_OverrideCategoryDefaultToSpeaker,
sizeof(doChangeDefaultRoute),
&doChangeDefaultRoute
);