Skip to content

Commit bcca037

Browse files
committed
Clean up eax/non-eax sound attenuation code
1 parent 4d3c751 commit bcca037

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/client/snd_dma.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2443,14 +2443,12 @@ void S_Update_(void) {
24432443
{
24442444
alSourcef(s_channels[source].alSource, AL_REFERENCE_DISTANCE, 768.0f);
24452445
alSourcef(s_channels[source].alSource, AL_MAX_DISTANCE, 2018.0f);
2446-
alSourcef(s_channels[source].alSource, AL_ROLLOFF_FACTOR, 1.0f);
24472446
alSourcef(s_channels[source].alSource, AL_GAIN, ((float)(ch->master_vol) * s_volume->value) / 255.0f);
24482447
}
24492448
else
24502449
{
24512450
alSourcef(s_channels[source].alSource, AL_REFERENCE_DISTANCE, 256.f);
24522451
alSourcef(s_channels[source].alSource, AL_MAX_DISTANCE, 1506.f);
2453-
alSourcef(s_channels[source].alSource, AL_ROLLOFF_FACTOR, 1.0f);
24542452
alSourcef(s_channels[source].alSource, AL_GAIN, ((float)(ch->master_vol) * s_volume->value) / 255.f);
24552453
}
24562454
}
@@ -2808,9 +2806,13 @@ void UpdateLoopingSounds()
28082806

28092807
alSourcei(s_channels[source].alSource, AL_LOOPING, AL_TRUE);
28102808
alSourcef(s_channels[source].alSource, AL_GAIN, (float)(ch->master_vol) * s_volume->value / 255.0f);
2811-
alSourcef(s_channels[source].alSource, AL_REFERENCE_DISTANCE, 256.f);
2812-
alSourcef(s_channels[source].alSource, AL_MAX_DISTANCE, 1506.f);
2813-
alSourcef(s_channels[source].alSource, AL_ROLLOFF_FACTOR, 1.0f);
2809+
2810+
if (s_bEAX) {
2811+
alSourcef(s_channels[source].alSource, AL_REFERENCE_DISTANCE, 400.f);
2812+
} else {
2813+
alSourcef(s_channels[source].alSource, AL_REFERENCE_DISTANCE, 256.f);
2814+
alSourcef(s_channels[source].alSource, AL_MAX_DISTANCE, 1506.f);
2815+
}
28142816

28152817
if (s_bEALFileLoaded)
28162818
UpdateEAXBuffer(ch);

0 commit comments

Comments
 (0)