I'm getting unexpected audio behaviour:
problem -- iPhone device volume is very faint, but if I plug in headphones the volume is perfect
- firstly, start app on iPhone the with nothing plugged in.
- Audio works, but it is so faint, really as if it was on minimum volume. but it is on maximum volume.
- now I plug in headphones. full volume. great!
- unplug headphones. Go to (2)
It doesn't matter whether I start with the headphones plugged in or not. It seems to be an unrelated problem
开发者_运维问答EDIT: this behaviour is peculiar to my app. I have tried Apple's AVTouch sample, and this behaves correctly with and without headphones.
wooHoo!
// kAudioSessionOverrideAudioRoute_Speaker would only work once.
// kAudioSessionProperty_OverrideCategoryDefaultToSpeaker works
// until the session changes.
SET_PROPERTY( kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, UInt32, (UInt32) YES );
basically the iPhone has 2 internal speakers, the ' receiver ' which jams up against your ear when you receive a call, and a far bigger external speaker ( those 2 grills either side of the power slot, the left one is the external speaker, the right one is the mic -- confusing: I once took my iPhone to a repair shop in Thailand because my ' right speaker ' wasn't functioning, and they even offered to fix it for me?! luckily I didn't like the price... )
anyway, for absolutely no good reason I can think of, the
SET_PROPERTY( kAudioSessionProperty_AudioCategory, UInt32,
kAudioSessionCategory_PlayAndRecord );
session defaults to using the receiver, so it just needs to be told to use the speaker instead.
精彩评论