소리 제어
음악이나 효과음을 재생한이후에 당신은 그것에 대해 컨트롤해야 할수도 있다.
예를들면 일시정지,정지,계속 재생 같은것 말이다.
이것은 아주 쉽게 할수 있다 아래를 보자.
일시정지
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>
'Cocos2d-x v3.17 > 고급 기능' 카테고리의 다른 글
[Cocos2d-x 고급기능]파일 시스템 접근 (0) | 2018.08.11 |
---|---|
[Cocos2d-x 고급기능]고급 사운드 기능 (0) | 2018.08.11 |
[Cocos2d-x 고급기능]배경 음악 재생 (0) | 2018.08.11 |
[Cocos2d-x 고급기능]음악과 효과음 (0) | 2018.08.11 |
[Cocos2d-x 고급기능]Point cast ,ray cast,queryRect,Debug (0) | 2018.08.11 |