开发者

IPhone audio: Volume faint ( but okay with headphones )

开发者 https://www.devze.com 2023-03-01 12:40 出处:网络
I\'m getting unexpected audio behaviour: problem -- iPhone device volume is very faint,but if I plug in headphones the volume is perfect

I'm getting unexpected audio behaviour:

problem -- iPhone device volume is very faint, but if I plug in headphones the volume is perfect

  1. firstly, start app on iPhone the with nothing plugged in.
  2. Audio works, but it is so faint, really as if it was on minimum volume. but it is on maximum volume.
  3. now I plug in headphones. full volume. great!
  4. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消