开发者

iPhone: How to choose what speaker to use?

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 开发者_如何学Pythonwill always be played via the loud speaker and at a maximum volume?

Thanks.


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜