Skip to content

Commit

Permalink
Adjust the secondary early reflections
Browse files Browse the repository at this point in the history
This reduces the delay to provide a direct (no delay) line from the early
reflections to the late reverb delay buffer.

This also reduces the early reflection output gain by half. The reasoning here
is that EFX seems to expect only one set of initial reflections, while we use
two. And being close enough in time, nearly doubles the amount of output
energy.

This does seem to improve the "harshness" of certain reverbs, smoothing the
difference between reverbs, and makes it more like other implementations (still
some work to do on late reverb, though).
  • Loading branch information
kcat committed Dec 2, 2023
1 parent 8d40ecc commit ed0420f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions alc/effects/reverb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ constexpr std::array<float,NUM_LINES> EARLY_ALLPASS_LENGTHS{{
* Using an average dimension of 1m, we get:
*/
constexpr std::array<float,NUM_LINES> EARLY_LINE_LENGTHS{{
5.9850400e-4f, 1.0913150e-3f, 1.5376658e-3f, 1.9419362e-3f
0.0000000e+0f, 4.9281100e-4f, 9.3916180e-4f, 1.3434322e-3f
}};

/* The late all-pass filter lengths are based on the late line lengths:
Expand Down Expand Up @@ -1057,7 +1057,7 @@ void ReverbPipeline::updateDelayLine(const float earlyDelay, const float lateDel
* output.
*/
length = (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS.front())/float{NUM_LINES}*density_mult +
std::max(lateDelay - EARLY_LINE_LENGTHS[0]*density_mult, 0.0f);
lateDelay;
mLateDelayTap[i][1] = float2uint(length * frequency);
}
}
Expand Down Expand Up @@ -1504,10 +1504,11 @@ void ReverbPipeline::processEarly(size_t offset, const size_t samplesToDo,
mEarlyDelayTap[j][0] = mEarlyDelayTap[j][1];
}

/* Apply a vector all-pass, to help color the initial reflections based
* on the diffusion strength.
/* Apply a vector all-pass, to help color the initial reflections.
* Don't apply diffusion-based scattering since these are still the
* first reflections.
*/
mEarly.VecAp.process(tempSamples, offset, mixX, mixY, todo);
mEarly.VecAp.process(tempSamples, offset, 1.0f, 0.0f, todo);

/* Apply a delay and bounce to generate secondary reflections, combine
* with the primary reflections and write out the result for mixing.
Expand All @@ -1525,7 +1526,7 @@ void ReverbPipeline::processEarly(size_t offset, const size_t samplesToDo,
size_t td{minz(early_delay.Mask+1 - feedb_tap, todo - i)};
do {
float sample{early_delay.Line[feedb_tap++][j]};
out[i] = tempSamples[j][i] + sample*feedb_coeff;
out[i] = (tempSamples[j][i] + sample*feedb_coeff) * 0.5f;
tempSamples[j][i] = sample;
++i;
} while(--td);
Expand Down

0 comments on commit ed0420f

Please sign in to comment.