Skip to content

Commit

Permalink
openal: Fix reverb slot configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
0lvin committed Feb 5, 2023
1 parent 74bb325 commit 6c9c81e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/client/sound/openal.c
Expand Up @@ -514,7 +514,8 @@ AL_SetReverb(int reverb_effect)
qalEffectf(ReverbEffect[QAL_REVERB_EFFECT], AL_REVERB_ROOM_ROLLOFF_FACTOR, reverb.flRoomRolloffFactor);
qalEffecti(ReverbEffect[QAL_REVERB_EFFECT], AL_REVERB_DECAY_HFLIMIT, reverb.iDecayHFLimit);

qalAuxiliaryEffectSloti(QAL_REVERB_EFFECT, AL_EFFECTSLOT_EFFECT, ReverbEffect[QAL_REVERB_EFFECT]);
qalAuxiliaryEffectSloti(ReverbEffectSlot[QAL_REVERB_EFFECT],
AL_EFFECTSLOT_EFFECT, ReverbEffect[QAL_REVERB_EFFECT]);
}

/*
Expand Down Expand Up @@ -1200,8 +1201,9 @@ AL_Underwater()
for (i = 0; i < s_numchannels; i++)
{
qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, underwaterFilter);
AL_SetReverb(22);
}

AL_SetReverb(22);
}

/*
Expand All @@ -1224,8 +1226,9 @@ AL_Overwater()
for (i = 0; i < s_numchannels; i++)
{
qalSourcei(s_srcnums[i], AL_DIRECT_FILTER, AL_FILTER_NULL);
AL_SetReverb(s_reverb_preset->value);
}

AL_SetReverb(s_reverb_preset->value);
}

/* ----------------------------------------------------------------- */
Expand Down Expand Up @@ -1305,14 +1308,19 @@ AL_InitReverbEffect(void)
return;

qalGenEffects(QAL_EFX_MAX, ReverbEffect);

if (qalGetError() != AL_NO_ERROR)
{
Com_Printf("Couldn't generate an OpenAL effect!\n");
return;
}

qalGenAuxiliaryEffectSlots(QAL_EFX_MAX, ReverbEffectSlot);
if (qalGetError() != AL_NO_ERROR)
{
Com_Printf("Couldn't generate an OpenAL auxiliary effect slot!\n");
return;
}

qalEffecti(ReverbEffect[QAL_REVERB_EFFECT], AL_EFFECT_TYPE, AL_EFFECT_REVERB);
AL_SetReverb(s_reverb_preset->value);
}
Expand Down

0 comments on commit 6c9c81e

Please sign in to comment.