【发布时间】:2012-01-03 09:40:46
【问题描述】:
我们在 Cocos2d 项目中使用了 AVAudioPlayer。音频变化不如预期。
代码:
NSURL* tapSound = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"tap"
ofType:@"m4a"]];
mClickSound = [[AVAudioPlayer alloc] initWithContentsOfURL: tapSound error: nil];
[mClickSound prepareToPlay];
mClickSound.numberOfLoops = 0;
[mClickSound setVolume: 1.0f];
mRandomLoopMusic = NULL;
在上面的代码中,我将音量设置为 1.0,但音乐音量未满。当我设置 10.0f 然后增加。所以我的疑问是音量范围是多少?在 AVAudioPlayer 的文档中,0 - 1 是范围,但在 cocos2D 示例中它不是真的。我们如何将音频范围限制为 0 - 1?
【问题讨论】:
标签: ios objective-c cocos2d-iphone avaudioplayer