We used AVAudioPlayer in the Cocos2d project. The sound change is not as expected.
CODE:
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;
In the above code, I install volume 1.0, but the volume of music is not full. When I set 10.0f then it increases. So, I doubt what is the volume range? In the AVAudioPlayer document, 0 - 1 is the range, but in the cocos2D example, it is not true. How can we limit the audio range to 0 - 1?
source share