Remove standard reverb specific processing functions

This commit is contained in:
Chris Robinson 2018-01-07 22:48:03 -08:00
parent d547f52d8f
commit 5d1207104a
6 changed files with 40 additions and 154 deletions

View File

@ -1028,8 +1028,6 @@ static void alc_initconfig(void)
if(ConfigValueFloat(NULL, "reverb", "boost", &valf))
ReverbBoost *= powf(10.0f, valf / 20.0f);
EmulateEAXReverb = GetConfigValueBool(NULL, "reverb", "emulate-eax", AL_FALSE);
if(((devs=getenv("ALSOFT_DRIVERS")) && devs[0]) ||
ConfigValueStr(NULL, NULL, "drivers", &devs))
{

View File

@ -38,11 +38,6 @@
*/
ALfloat ReverbBoost = 1.0f;
/* Specifies whether to use a standard reverb effect in place of EAX reverb (no
* high-pass, modulation, or echo).
*/
ALboolean EmulateEAXReverb = AL_FALSE;
/* This is the maximum number of samples processed for each inner loop
* iteration. */
#define MAX_UPDATE_SAMPLES 256
@ -249,8 +244,6 @@ typedef struct VecAllpass {
typedef struct ALreverbState {
DERIVE_FROM_TYPE(ALeffectState);
ALboolean IsEax;
/* All delay lines are allocated as a single buffer to reduce memory
* fragmentation and management code.
*/
@ -369,8 +362,6 @@ static void ALreverbState_Construct(ALreverbState *state)
ALeffectState_Construct(STATIC_CAST(ALeffectState, state));
SET_VTABLE2(ALreverbState, ALeffectState, state);
state->IsEax = AL_FALSE;
state->TotalSamples = 0;
state->SampleBuffer = NULL;
@ -1293,11 +1284,6 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Conte
ALfloat gain, gainlf, gainhf;
ALsizei i;
if(Slot->Params.EffectType == AL_EFFECT_EAXREVERB && !EmulateEAXReverb)
State->IsEax = AL_TRUE;
else if(Slot->Params.EffectType == AL_EFFECT_REVERB || EmulateEAXReverb)
State->IsEax = AL_FALSE;
/* Calculate the master filters */
hfScale = props->Reverb.HFReference / frequency;
/* Restrict the filter gains from going below -60dB to keep the filter from
@ -1739,112 +1725,14 @@ static ALvoid LateReverb_Unfaded(ALreverbState *State, const ALsizei todo, ALflo
}
}
typedef ALfloat (*ProcMethodType)(ALreverbState *State, const ALsizei todo, ALfloat fade,
const ALfloat (*restrict input)[MAX_UPDATE_SAMPLES],
ALfloat (*restrict early)[MAX_UPDATE_SAMPLES], ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]);
/* Perform the non-EAX reverb pass on a given input sample, resulting in
* four-channel output.
*/
static ALfloat VerbPass(ALreverbState *State, const ALsizei todo, ALfloat fade,
const ALfloat (*restrict input)[MAX_UPDATE_SAMPLES],
ALfloat (*restrict early)[MAX_UPDATE_SAMPLES],
ALfloat (*restrict late)[MAX_UPDATE_SAMPLES])
{
ALsizei i, c;
for(c = 0;c < 4;c++)
{
/* Low-pass filter the incoming samples (use the early buffer as temp
* storage).
*/
ALfilterState_process(&State->Filter[c].Lp, &early[0][0], input[c], todo);
/* Feed the initial delay line. */
for(i = 0;i < todo;i++)
DelayLineIn(&State->Delay, State->Offset+i, c, early[0][i]);
}
if(fade < 1.0f)
{
/* Generate early reflections. */
EarlyReflection_Faded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Faded(State, todo, fade, late);
fade = minf(1.0f, fade + todo*FadeStep);
}
else
{
/* Generate early reflections. */
EarlyReflection_Unfaded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Unfaded(State, todo, fade, late);
}
/* Step all delays forward one sample. */
State->Offset += todo;
return fade;
}
/* Perform the EAX reverb pass on a given input sample, resulting in four-
* channel output.
*/
static ALfloat EAXVerbPass(ALreverbState *State, const ALsizei todo, ALfloat fade,
const ALfloat (*restrict input)[MAX_UPDATE_SAMPLES],
ALfloat (*restrict early)[MAX_UPDATE_SAMPLES],
ALfloat (*restrict late)[MAX_UPDATE_SAMPLES])
{
ALsizei i, c;
for(c = 0;c < 4;c++)
{
/* Band-pass the incoming samples. Use the early output lines for temp
* storage.
*/
ALfilterState_process(&State->Filter[c].Lp, early[0], input[c], todo);
ALfilterState_process(&State->Filter[c].Hp, early[1], early[0], todo);
/* Feed the initial delay line. */
for(i = 0;i < todo;i++)
DelayLineIn(&State->Delay, State->Offset+i, c, early[1][i]);
}
if(fade < 1.0f)
{
/* Generate early reflections. */
EarlyReflection_Faded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Faded(State, todo, fade, late);
fade = minf(1.0f, fade + todo*FadeStep);
}
else
{
/* Generate early reflections. */
EarlyReflection_Unfaded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Unfaded(State, todo, fade, late);
}
/* Step all delays forward. */
State->Offset += todo;
return fade;
}
static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels)
{
ProcMethodType ReverbProc = State->IsEax ? EAXVerbPass : VerbPass;
ALfloat (*restrict afmt)[MAX_UPDATE_SAMPLES] = State->AFormatSamples;
ALfloat (*restrict early)[MAX_UPDATE_SAMPLES] = State->EarlySamples;
ALfloat (*restrict late)[MAX_UPDATE_SAMPLES] = State->ReverbSamples;
ALsizei fadeCount = State->FadeCount;
ALfloat fade = (ALfloat)fadeCount / FADE_SAMPLES;
ALsizei base, c;
ALsizei base, c, i;
/* Process reverb for these samples. */
for(base = 0;base < SamplesToDo;)
@ -1862,7 +1750,40 @@ static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, c
);
/* Process the samples for reverb. */
fade = ReverbProc(State, todo, fade, afmt, early, late);
for(c = 0;c < 4;c++)
{
/* Band-pass the incoming samples. Use the early output lines for
* temp storage.
*/
ALfilterState_process(&State->Filter[c].Lp, early[0], afmt[c], todo);
ALfilterState_process(&State->Filter[c].Hp, early[1], early[0], todo);
/* Feed the initial delay line. */
for(i = 0;i < todo;i++)
DelayLineIn(&State->Delay, State->Offset+i, c, early[1][i]);
}
if(fade < 1.0f)
{
/* Generate early reflections. */
EarlyReflection_Faded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Faded(State, todo, fade, late);
fade = minf(1.0f, fade + todo*FadeStep);
}
else
{
/* Generate early reflections. */
EarlyReflection_Unfaded(State, todo, fade, early);
/* Generate late reverb. */
LateReverb_Unfaded(State, todo, fade, late);
}
/* Step all delays forward. */
State->Offset += todo;
if(UNLIKELY(fadeCount < FADE_SAMPLES) && (fadeCount += todo) >= FADE_SAMPLES)
{
/* Update the cross-fading delay line taps. */

View File

@ -26,7 +26,6 @@ enum {
extern ALboolean DisabledEffects[MAX_EFFECTS];
extern ALfloat ReverbBoost;
extern ALboolean EmulateEAXReverb;
struct ALeffectVtable {
void (*const setParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val);

View File

@ -319,12 +319,6 @@ surround71 =
# value of 0 means no change.
#boost = 0
## emulate-eax: (global)
# Allows the standard reverb effect to be used in place of EAX reverb. EAX
# reverb processing is a bit more CPU intensive than standard, so this option
# allows a simpler effect to be used at the loss of some quality.
#emulate-eax = false
##
## PulseAudio backend stuff
##

View File

@ -370,7 +370,6 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->backendCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->defaultReverbComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(enableApplyButton()));
connect(ui->emulateEaxCheckBox, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->enableEaxReverbCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->enableStdReverbCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
connect(ui->enableChorusCheck, SIGNAL(stateChanged(int)), this, SLOT(enableApplyButton()));
@ -822,8 +821,6 @@ void MainWindow::loadConfig(const QString &fname)
}
}
ui->emulateEaxCheckBox->setChecked(settings.value("reverb/emulate-eax", false).toBool());
QStringList excludefx = settings.value("excludefx").toStringList();
if(excludefx.size() == 1)
excludefx = excludefx[0].split(QChar(','));
@ -1031,11 +1028,6 @@ void MainWindow::saveConfig(const QString &fname) const
settings.setValue("default-reverb", str);
}
if(ui->emulateEaxCheckBox->isChecked())
settings.setValue("reverb/emulate-eax", "true");
else
settings.remove("reverb/emulate-eax"/*, "false"*/);
strlist.clear();
if(!ui->enableEaxReverbCheck->isChecked())
strlist.append("eaxreverb");

View File

@ -52,6 +52,9 @@
<height>401</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Playback</string>
@ -128,7 +131,7 @@ to stereo output.</string>
<rect>
<x>380</x>
<y>20</y>
<width>91</width>
<width>93</width>
<height>29</height>
</rect>
</property>
@ -1924,27 +1927,6 @@ be useful for preventing those extensions from being used.</string>
<attribute name="title">
<string>Effects</string>
</attribute>
<widget class="QCheckBox" name="emulateEaxCheckBox">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="toolTip">
<string>Uses a simpler reverb method to emulate the EAX reverb
effect. This may slightly improve performance at the cost of
some quality.</string>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Emulate EAX Reverb:</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
@ -2148,7 +2130,7 @@ added by the ALC_EXT_DEDICATED extension.</string>
<rect>
<x>160</x>
<y>20</y>
<width>123</width>
<width>125</width>
<height>29</height>
</rect>
</property>