From f535ec9b25c57cbe03e9386e5be172325d85196e Mon Sep 17 00:00:00 2001 From: James Chen Date: Mon, 22 May 2017 09:48:11 +0800 Subject: [PATCH] [win32] Call 'update' method in 'stop/stopAll' to cleanup immediately --- native/cocos/audio/win32/AudioEngine-win32.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native/cocos/audio/win32/AudioEngine-win32.cpp b/native/cocos/audio/win32/AudioEngine-win32.cpp index c3d8b50b52..99422d35a8 100644 --- a/native/cocos/audio/win32/AudioEngine-win32.cpp +++ b/native/cocos/audio/win32/AudioEngine-win32.cpp @@ -360,6 +360,9 @@ void AudioEngineImpl::stop(int audioID) //Note: Don't set the flag to false here, it should be set in 'update' function. // Otherwise, the state got from alSourceState may be wrong // _alSourceUsed[player->_alSource] = false; + + // Call 'update' method to cleanup immediately since the schedule may be cancelled without any notification. + update(0.0f); } void AudioEngineImpl::stopAll() @@ -374,6 +377,9 @@ void AudioEngineImpl::stopAll() // { // _alSourceUsed[_alSources[index]] = false; // } + + // Call 'update' method to cleanup immediately since the schedule may be cancelled without any notification. + update(0.0f); } float AudioEngineImpl::getDuration(int audioID)