cocos2d-iphonesimpleaudioengine

Is it possible to adjust the sound volume cocos2d?


I am using the following method, and express a sound effect in cocos2d.

[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BackGround.m4a"];

But sound volume of BackgroundMusic is too small.

so, is there a way that adjust a sound volume?


Solution

  • The backgroundMusicVolume property of the SimpleAudioEngine class can be used for this.

    - (float) backgroundMusicVolume [read, write, assign]
    
       //Background music volume. Range is 0.0f to 1.0f. This will only have an effect if willPlayBackgroundMusic returns YES