mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
OpenAL_Output: When a source is finished, rewind it instead of stopping it.
This works around a bug in the MacOS OpenAL implementation.
This commit is contained in:
parent
41499ea11f
commit
e9d8ff532f
1 changed files with 10 additions and 2 deletions
|
@ -437,7 +437,9 @@ bool OpenAL_SoundStream::process()
|
||||||
alGetSourcei(mSource, AL_SOURCE_STATE, &state);
|
alGetSourcei(mSource, AL_SOURCE_STATE, &state);
|
||||||
if(state != AL_PLAYING && state != AL_PAUSED)
|
if(state != AL_PLAYING && state != AL_PAUSED)
|
||||||
{
|
{
|
||||||
|
// Ensure all processed buffers are removed so we don't replay them.
|
||||||
refillQueue();
|
refillQueue();
|
||||||
|
|
||||||
alSourcePlay(mSource);
|
alSourcePlay(mSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -906,7 +908,10 @@ void OpenAL_Output::finishSound(MWBase::SoundPtr sound)
|
||||||
ALuint source = GET_PTRID(sound->mHandle);
|
ALuint source = GET_PTRID(sound->mHandle);
|
||||||
sound->mHandle = 0;
|
sound->mHandle = 0;
|
||||||
|
|
||||||
alSourceStop(source);
|
// Rewind the stream instead of stopping it, this puts the source into an AL_INITIAL state,
|
||||||
|
// which works around a bug in the MacOS OpenAL implementation which would otherwise think
|
||||||
|
// the initial queue already played when it hasn't.
|
||||||
|
alSourceRewind(source);
|
||||||
alSourcei(source, AL_BUFFER, 0);
|
alSourcei(source, AL_BUFFER, 0);
|
||||||
|
|
||||||
mFreeSources.push_back(source);
|
mFreeSources.push_back(source);
|
||||||
|
@ -1006,7 +1011,10 @@ void OpenAL_Output::finishStream(MWBase::SoundStreamPtr sound)
|
||||||
sound->mHandle = 0;
|
sound->mHandle = 0;
|
||||||
mStreamThread->remove(stream);
|
mStreamThread->remove(stream);
|
||||||
|
|
||||||
alSourceStop(source);
|
// Rewind the stream instead of stopping it, this puts the source into an AL_INITIAL state,
|
||||||
|
// which works around a bug in the MacOS OpenAL implementation which would otherwise think
|
||||||
|
// the initial queue already played when it hasn't.
|
||||||
|
alSourceRewind(source);
|
||||||
alSourcei(source, AL_BUFFER, 0);
|
alSourcei(source, AL_BUFFER, 0);
|
||||||
|
|
||||||
mFreeSources.push_back(source);
|
mFreeSources.push_back(source);
|
||||||
|
|
Loading…
Reference in a new issue