SimpleAudioEngine background volume with CCActionTween

929 Views Asked by At

Is it possible to have a fade out effect for SimpleAudioEngine background music using the CCActionTween? I know that the volume property is an float between 1 and 0.

If it is possible, then a sample code would be much appreciated.

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

AFAIK, there are no mechanisms within cocos2d to do what you are asking about. A CCNode derivative has the runAction method, but there are no CCNode derivatives for that embed sound controls. I perform sound fade in-out in the main loop as shown here . The method fadeOutBackgroundMusic is exposed by a singleton, and available anywhere in the code. It has a corresponding fadeInBackgroundMusic method.