Cocos2d-x SoundEffect 作る方法について
CODE
SimpleAudioEngine.h
int createEffectWave(float pitch,float pan,float gain);
pitch is 音のスピード pan is 右の音と左の音 gain is声の距離
まず include simpleAudioEngine
#include "SimpleAudioEngine.h"
そして set define the Music of Effect FileURL;
#define SoundWave "sound.mp3"
int IntelligenceMemoryAudioContainer::createEffectWave(float pitch,float pan,float gain){
//必ずpreloadEffectください!
CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(PaperWave);
//Volume
:SimpleAudioEngine::getInstance()->setEffectsVolume(10);
//もし SOUNDID必要な時は この方法でIDをもらう事ができます
return CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(SoundWave,false,pitch,pan,gain);
} ```
後は必要の時で使用するのみ!