views:

161

answers:

2

Hi,

As I am aware iPhone has got 2 speakers: quiet(phone) and loud speakers.

I am using AVAudioPlayer to play an mp3 file. iPhone seems to choose what speaker to use arbitrary. How can I make sure that my audio will always be played via the loud speaker and at a maximum volume?

Thanks.

+1  A: 

There you go.

luvieere
A: 

I rearly use AVAudioPlayer. So I don't know how to choose speaker. But if you use CocosDenshoin & SimpleAudioEngine, then the following code may be useful for you.

[[SimpleAudioEngine sharedEngine] playEffect:pad3TuneFile pitch:1.0f pan: 1.0 gain:pad3Volume];

Here, the value of pan is in between -1.0 to 1.0. Depending on the value the volume of speaker is changed. For example, if you choose the value 0.0, then both speaker will play with same volume and if you choose the value 1.0, the left speaker will play with full sound and the right speaker will be muted.

MAHMUD