mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +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
|
/* Since the OpenAL distance is decoupled from the sound's distance, get the OpenAL
|
||||||
* distance that corresponds to the area radius. */
|
* distance that corresponds to the area radius. */
|
||||||
alSourcef(source, AL_SOURCE_RADIUS, (chanflags&SNDF_AREA) ?
|
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)
|
else if((chanflags&SNDF_AREA) && dist_sqr < AREA_SOUND_RADIUS*AREA_SOUND_RADIUS)
|
||||||
|
|
Loading…
Reference in a new issue