mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-04 01:41:56 +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
61e198f83d
commit
09fbbfb1c6
2 changed files with 7 additions and 3 deletions
|
@ -1415,7 +1415,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
|
||||
|
|
|
@ -571,9 +571,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