Is it possible to adjust the sound volume cocos2d?

陌路散爱 提交于 2019-12-11 04:04:25

问题


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?


回答1:


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



回答2:


[[SimpleAudioEngine sharedEngine]setBackgroundMusicVolume:1.0f];

From 0.0f to 1.0f.



来源:https://stackoverflow.com/questions/8344845/is-it-possible-to-adjust-the-sound-volume-cocos2d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!