mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Fixed OpenAL regression with looping sounds with playing length 0.
If such case occurs, the starttime parameter passed to the sound functions is ignored and truncated to 0.
This commit is contained in:
parent
e2e47b8d8c
commit
8ab6575bd1
2 changed files with 7 additions and 3 deletions
|
@ -1420,7 +1420,10 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
|
|||
|
||||
if(!reuse_chan || reuse_chan->StartTime == 0)
|
||||
{
|
||||
float st = (chanflags & SNDF_LOOP) ? fmod(startTime, (float)GetMSLength(sfx) / 1000.f) : clamp<float>(startTime, 0.f, (float)GetMSLength(sfx) / 1000.f);
|
||||
float sfxlength = (float)GetMSLength(sfx) / 1000.f;
|
||||
float st = (chanflags & SNDF_LOOP)
|
||||
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||
: clamp<float>(startTime, 0.f, sfxlength);
|
||||
alSourcef(source, AL_SEC_OFFSET, st);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -547,9 +547,10 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
if (chanflags & (CHANF_UI|CHANF_NOPAUSE)) startflags |= SNDF_NOPAUSE;
|
||||
if (chanflags & CHANF_UI) startflags |= SNDF_NOREVERB;
|
||||
|
||||
float sfxlength = (float)GSnd->GetMSLength(sfx->data) / 1000.f;
|
||||
startTime = (startflags & SNDF_LOOP)
|
||||
? fmod(startTime, (float)GSnd->GetMSLength(sfx->data) / 1000.f)
|
||||
: clamp<float>(startTime, 0.f, (float)GSnd->GetMSLength(sfx->data) / 1000.f);
|
||||
? (sfxlength > 0 ? fmod(startTime, sfxlength) : 0)
|
||||
: clamp<float>(startTime, 0.f, sfxlength);
|
||||
|
||||
if (attenuation > 0 && type != SOURCE_None)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue