1

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.

P i
  • 29,020
  • 36
  • 159
  • 267
  • Where is the programming related question? – Claus Broch Apr 28 '11 at 13:25
  • If you're even asking that question, it means that it is completely out of your area of expertise, and you really shouldn't be throwing an oar in. Is it you that has voted to close this question? – P i Apr 28 '11 at 14:08
  • @Claus, this is a programming question, see Ohmu’s answer. – zoul Apr 29 '11 at 06:15

1 Answers1

2

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.

P i
  • 29,020
  • 36
  • 159
  • 267
  • 1
    "for absolutely no good reason I can think of" - It's because if you actually do play and record sound at the same time, then the microphone at the bottom of the phone would pick up a lot more unwanted sound from the speaker right next to it than from the one all the way up at your ear. – Martin Gjaldbaek Jun 07 '11 at 13:26