IPhone audio: Volume faint ( but okay with headphones )

◇◆丶佛笑我妖孽 提交于 2019-12-11 07:45:38

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5818756/iphone-audio-volume-faint-but-okay-with-headphones

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!