mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +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
@ -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…
x
Reference in New Issue
Block a user