본문 바로가기

Cocos2d-x v3.17/고급 기능

[Cocos2d-x 고급기능]소리 제어

반응형

소리 제어

음악이나 효과음을 재생한이후에 당신은 그것에 대해 컨트롤해야 할수도 있다.

예를들면 일시정지,정지,계속 재생 같은것 말이다.

이것은 아주 쉽게 할수 있다 아래를 보자.


일시정지

C++

#include "SimpleAudioEngine.h"

using namespace CocosDenshion;

auto audio = SimpleAudioEngine::getInstance();

// pause background music.

audio->pauseBackgroundMusic();

// pause a sound effect.

audio->pauseEffect();

// pause all sound effects.

audio->pauseAllEffects();


정지

C++

#include "SimpleAudioEngine.h"

using namespace CocosDenshion;

auto audio = SimpleAudioEngine::getInstance();

// stop background music.

audio->stopBackgroundMusic();

// stop a sound effect.

audio->stopEffect();

// stops all running sound effects.

audio->stopAllEffects();


계속 재생

C++

#include "SimpleAudioEngine.h"

using namespace CocosDenshion;

auto audio = SimpleAudioEngine::getInstance();

// resume background music.

audio->resumeBackgroundMusic();

// resume a sound effect.

audio->resumeEffect();

// resume all sound effects.

audio->resumeAllEffects();

 

출처: <http://cocos2d-x.org/docs/cocos2d-x/zh/audio/operations.html>

 


반응형