mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Avoid divide-by-0 when the area sound radius is less than the max distance
This commit is contained in:
parent
66c61a7c8b
commit
e298f8389b
1 changed files with 2 additions and 1 deletions
|
@ -1431,7 +1431,8 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
|
|||
/* Since the OpenAL distance is decoupled from the sound's distance, get the OpenAL
|
||||
* distance that corresponds to the area radius. */
|
||||
alSourcef(source, AL_SOURCE_RADIUS, (chanflags&SNDF_AREA) ?
|
||||
1.f / GetRolloff(rolloff, AREA_SOUND_RADIUS) : 0.f
|
||||
// Clamp in case the max distance is <= the area radius
|
||||
1.f/MAX<float>(GetRolloff(rolloff, AREA_SOUND_RADIUS), 0.00001f) : 0.f
|
||||
);
|
||||
}
|
||||
else if((chanflags&SNDF_AREA) && dist_sqr < AREA_SOUND_RADIUS*AREA_SOUND_RADIUS)
|
||||
|
|
Loading…
Reference in a new issue