From 60272f6b88893fcc35385e1fe7b1e34fa9a103d8 Mon Sep 17 00:00:00 2001 From: minggo Date: Sun, 14 Apr 2019 23:52:52 -0700 Subject: [PATCH] fix bug that SimpleAudioEngine can not change effect volume (#19605) --- cocos/audio/SimpleAudioEngine.cpp | 2 +- cocos/audio/include/SimpleAudioEngine.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cocos/audio/SimpleAudioEngine.cpp b/cocos/audio/SimpleAudioEngine.cpp index f5e48cb9ab..09d0084857 100644 --- a/cocos/audio/SimpleAudioEngine.cpp +++ b/cocos/audio/SimpleAudioEngine.cpp @@ -172,7 +172,7 @@ void SimpleAudioEngine::setEffectsVolume(float volume) */ unsigned int SimpleAudioEngine::playEffect(const char* filePath, bool loop, float pitch, float pan, float gain) { - return AudioEngine::play2d(filePath, loop, gain); + return AudioEngine::play2d(filePath, loop, g_SimpleAudioEngine->effectsvolume); } /** diff --git a/cocos/audio/include/SimpleAudioEngine.h b/cocos/audio/include/SimpleAudioEngine.h index 09ed251d3b..3dfc2e7eac 100644 --- a/cocos/audio/include/SimpleAudioEngine.h +++ b/cocos/audio/include/SimpleAudioEngine.h @@ -183,9 +183,10 @@ public: * @param gain Volume, in the range of [0..1]. The normal value is 1. * @return The sound id. * - * @note Full support is under development, now there are limitations: - * - no pitch effect on Samsung Galaxy S2 with OpenSL backend enabled; - * - no pitch/pan/gain on win32. + * @note Now use Audio Engine to implement SimpleAudioEngine, and Audio Engine doesn't support + * - pitch + * - pan + * - gain */ virtual unsigned int playEffect(const char* filePath, bool loop = false, float pitch = 1.0f, float pan = 0.0f, float gain = 1.0f);