mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 13:15:32 +00:00
Set the OpenAL source offset after setting the buffer
This is to work around a bug in the Rapture3D driver.
This commit is contained in:
parent
c2c595407c
commit
4e3ae85c11
1 changed files with 22 additions and 2 deletions
|
@ -1145,14 +1145,24 @@ bool OpenAL_Output::playSound(Sound *sound, Sound_Handle data, float offset)
|
|||
|
||||
initCommon2D(source, sound->getPosition(), sound->getRealVolume(), sound->getPitch(),
|
||||
sound->getIsLooping(), sound->getUseEnv());
|
||||
alSourcei(source, AL_BUFFER, GET_PTRID(data));
|
||||
alSourcef(source, AL_SEC_OFFSET, offset);
|
||||
if(getALError() != AL_NO_ERROR)
|
||||
{
|
||||
alSourceRewind(source);
|
||||
alSourcei(source, AL_BUFFER, 0);
|
||||
alGetError();
|
||||
return false;
|
||||
}
|
||||
|
||||
alSourcei(source, AL_BUFFER, GET_PTRID(data));
|
||||
alSourcePlay(source);
|
||||
if(getALError() != AL_NO_ERROR)
|
||||
{
|
||||
alSourceRewind(source);
|
||||
alSourcei(source, AL_BUFFER, 0);
|
||||
alGetError();
|
||||
return false;
|
||||
}
|
||||
|
||||
mFreeSources.pop_front();
|
||||
sound->mHandle = MAKE_PTRID(source);
|
||||
|
@ -1175,14 +1185,24 @@ bool OpenAL_Output::playSound3D(Sound *sound, Sound_Handle data, float offset)
|
|||
initCommon3D(source, sound->getPosition(), sound->getMinDistance(), sound->getMaxDistance(),
|
||||
sound->getRealVolume(), sound->getPitch(), sound->getIsLooping(),
|
||||
sound->getUseEnv());
|
||||
alSourcei(source, AL_BUFFER, GET_PTRID(data));
|
||||
alSourcef(source, AL_SEC_OFFSET, offset);
|
||||
if(getALError() != AL_NO_ERROR)
|
||||
{
|
||||
alSourceRewind(source);
|
||||
alSourcei(source, AL_BUFFER, 0);
|
||||
alGetError();
|
||||
return false;
|
||||
}
|
||||
|
||||
alSourcei(source, AL_BUFFER, GET_PTRID(data));
|
||||
alSourcePlay(source);
|
||||
if(getALError() != AL_NO_ERROR)
|
||||
{
|
||||
alSourceRewind(source);
|
||||
alSourcei(source, AL_BUFFER, 0);
|
||||
alGetError();
|
||||
return false;
|
||||
}
|
||||
|
||||
mFreeSources.pop_front();
|
||||
sound->mHandle = MAKE_PTRID(source);
|
||||
|
|
Loading…
Reference in a new issue