mirror of https://github.com/axmolengine/axmol.git
AudioEngine[WIN32]:Fixed `FinishCallback` may not been invoked when the sound play completes.
This commit is contained in:
parent
a0c7e10a82
commit
42fa33dc6e
|
@ -322,6 +322,7 @@ bool AudioEngineImpl::stop(int audioID)
|
||||||
_alSourceUsed[player._alSource] = false;
|
_alSourceUsed[player._alSource] = false;
|
||||||
if (player._streamingSource)
|
if (player._streamingSource)
|
||||||
{
|
{
|
||||||
|
player._ready = false;
|
||||||
player.notifyExitThread();
|
player.notifyExitThread();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -346,6 +347,7 @@ void AudioEngineImpl::stopAll()
|
||||||
auto& player = it->second;
|
auto& player = it->second;
|
||||||
if (player._streamingSource)
|
if (player._streamingSource)
|
||||||
{
|
{
|
||||||
|
player._ready = false;
|
||||||
player.notifyExitThread();
|
player.notifyExitThread();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +459,7 @@ void AudioEngineImpl::update(float dt)
|
||||||
auto& player = it->second;
|
auto& player = it->second;
|
||||||
alGetSourcei(player._alSource, AL_SOURCE_STATE, &sourceState);
|
alGetSourcei(player._alSource, AL_SOURCE_STATE, &sourceState);
|
||||||
|
|
||||||
if (player._readForRemove)
|
if (player._readForRemove && !player._ready)
|
||||||
{
|
{
|
||||||
it = _audioPlayers.erase(it);
|
it = _audioPlayers.erase(it);
|
||||||
}
|
}
|
||||||
|
@ -472,6 +474,7 @@ void AudioEngineImpl::update(float dt)
|
||||||
|
|
||||||
if (player._streamingSource)
|
if (player._streamingSource)
|
||||||
{
|
{
|
||||||
|
player._ready = false;
|
||||||
player.notifyExitThread();
|
player.notifyExitThread();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue