Always use the pitch multiplier when underwater

This commit is contained in:
Chris Robinson 2014-06-22 22:22:45 -07:00
parent b2f9430fb1
commit 075c5d872d

View file

@ -1083,9 +1083,8 @@ FISoundChannel *OpenALSoundRenderer::StartSound(SoundHandle sfx, float vol, int
alSource3i(source, AL_AUXILIARY_SEND_FILTER, 0, 0, AL_FILTER_NULL);
}
alSourcef(source, AL_ROOM_ROLLOFF_FACTOR, 0.f);
alSourcef(source, AL_PITCH, PITCH(pitch));
}
else if(WasInWater && !(chanflags&SNDF_NOREVERB))
if(WasInWater && !(chanflags&SNDF_NOREVERB))
alSourcef(source, AL_PITCH, PITCH(pitch)*PITCH_MULT);
else
alSourcef(source, AL_PITCH, PITCH(pitch));
@ -1258,9 +1257,8 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
alSource3i(source, AL_AUXILIARY_SEND_FILTER, 0, 0, AL_FILTER_NULL);
}
alSourcef(source, AL_ROOM_ROLLOFF_FACTOR, 0.f);
alSourcef(source, AL_PITCH, PITCH(pitch));
}
else if(WasInWater && !(chanflags&SNDF_NOREVERB))
if(WasInWater && !(chanflags&SNDF_NOREVERB))
alSourcef(source, AL_PITCH, PITCH(pitch)*PITCH_MULT);
else
alSourcef(source, AL_PITCH, PITCH(pitch));
@ -1519,8 +1517,7 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
const_cast<ReverbContainer*>(env)->Modified = false;
}
// NOTE: Moving into and out of water will undo pitch variations on sounds
// if either snd_waterreverb or EFX are disabled.
// NOTE: Moving into and out of water will undo pitch variations on sounds.
if(listener->underwater || env->SoftwareWater)
{
if(!WasInWater)
@ -1530,13 +1527,11 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
if(EnvSlot != 0 && *snd_waterreverb)
{
// Find the "Underwater" reverb environment
env = Environments;
while(env && env->ID != 0x1600)
env = env->Next;
env = S_FindEnvironment(0x1600);
LoadReverb(env ? env : DefaultEnvironments[0]);
alFilterf(EnvFilters[0], AL_LOWPASS_GAIN, 0.1f);
alFilterf(EnvFilters[0], AL_LOWPASS_GAINHF, 1.f);
alFilterf(EnvFilters[0], AL_LOWPASS_GAIN, 1.f);
alFilterf(EnvFilters[0], AL_LOWPASS_GAINHF, 0.125f);
alFilterf(EnvFilters[1], AL_LOWPASS_GAIN, 1.f);
alFilterf(EnvFilters[1], AL_LOWPASS_GAINHF, 1.f);
@ -1547,11 +1542,9 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
alSource3i(*i, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]);
}
}
else
{
foreach(ALuint, i, ReverbSfx)
alSourcef(*i, AL_PITCH, PITCH_MULT);
}
foreach(ALuint, i, ReverbSfx)
alSourcef(*i, AL_PITCH, PITCH_MULT);
getALError();
}
}
@ -1573,11 +1566,9 @@ void OpenALSoundRenderer::UpdateListener(SoundListener *listener)
alSource3i(*i, AL_AUXILIARY_SEND_FILTER, EnvSlot, 0, EnvFilters[1]);
}
}
else
{
foreach(ALuint, i, ReverbSfx)
alSourcef(*i, AL_PITCH, 1.f);
}
foreach(ALuint, i, ReverbSfx)
alSourcef(*i, AL_PITCH, 1.f);
getALError();
}
}