Fix reverb issue

This commit is contained in:
Jack Andersen 2016-05-16 11:00:37 -10:00
parent e9213ab179
commit 531961be78
4 changed files with 18 additions and 18 deletions

View File

@ -28,7 +28,7 @@ template <typename T>
class EffectReverbHiImp;
/** Reverb effect with configurable reflection filtering */
class EffectReverb
class EffectReverbStd
{
protected:
float x140_x1c8_coloration; /**< [0.0, 1.0] influences filter coefficients to define surface characteristics of a room */
@ -42,8 +42,8 @@ protected:
friend class EffectReverbStdImp;
template <typename T>
friend class EffectReverbHiImp;
EffectReverb(float coloration, float mix, float time,
float damping, float preDelay);
EffectReverbStd(float coloration, float mix, float time,
float damping, float preDelay);
public:
template <typename T>
using ImpType = EffectReverbStdImp<T>;
@ -80,7 +80,7 @@ public:
};
/** Reverb effect with configurable reflection filtering, adds per-channel low-pass and crosstalk */
class EffectReverbHi : public EffectReverb
class EffectReverbHi : public EffectReverbStd
{
float x1dc_crosstalk; /**< [0.0, 1.0] factor defining how much reflections are allowed to bleed to other channels */
@ -101,7 +101,7 @@ public:
/** Standard-quality 2-stage reverb */
template <typename T>
class EffectReverbStdImp : public EffectBase<T>, public EffectReverb
class EffectReverbStdImp : public EffectBase<T>, public EffectReverbStd
{
ReverbDelayLine x0_AP[8][2] = {}; /**< All-pass delay lines */
ReverbDelayLine x78_C[8][2] = {}; /**< Comb delay lines */

View File

@ -80,8 +80,8 @@ public:
EffectDelay& makeDelay(uint32_t initDelay, uint32_t initFeedback, uint32_t initOutput);
/** Add new standard-quality reverb effect to effect stack and assume ownership */
EffectReverb& makeReverbStd(float coloration, float mix, float time,
float damping, float preDelay);
EffectReverbStd& makeReverbStd(float coloration, float mix, float time,
float damping, float preDelay);
/** Add new high-quality reverb effect to effect stack and assume ownership */
EffectReverbHi& makeReverbHi(float coloration, float mix, float time,

View File

@ -53,7 +53,7 @@ void ReverbDelayLine::setdelay(int32_t delay)
x4_outPoint += x8_length;
}
EffectReverb::EffectReverb(float coloration, float mix, float time,
EffectReverbStd::EffectReverbStd(float coloration, float mix, float time,
float damping, float preDelay)
: x140_x1c8_coloration(clamp(0.f, coloration, 1.f)),
x144_x1cc_mix(clamp(0.f, mix, 1.f)),
@ -64,14 +64,14 @@ EffectReverb::EffectReverb(float coloration, float mix, float time,
EffectReverbHi::EffectReverbHi(float coloration, float mix, float time,
float damping, float preDelay, float crosstalk)
: EffectReverb(coloration, mix, time, damping, preDelay),
: EffectReverbStd(coloration, mix, time, damping, preDelay),
x1dc_crosstalk(clamp(0.f, crosstalk, 1.0f))
{}
template <typename T>
EffectReverbStdImp<T>::EffectReverbStdImp(float coloration, float mix, float time,
float damping, float preDelay, double sampleRate)
: EffectReverb(coloration, mix, time, damping, preDelay),
: EffectReverbStd(coloration, mix, time, damping, preDelay),
m_sampleRate(sampleRate)
{}
@ -87,7 +87,7 @@ void EffectReverbStdImp<T>::_update()
size_t tapDelay = CTapDelays[t] * m_sampleRate / 32000.0;
combLine.allocate(tapDelay);
combLine.setdelay(tapDelay);
xf4_combCoef[c][t] = std::pow(10.f, tapDelay * -3 / timeSamples);
xf4_combCoef[c][t] = std::pow(10.f, tapDelay * -3.f / timeSamples);
}
for (int t=0 ; t<2 ; ++t)
@ -153,9 +153,10 @@ void EffectReverbStdImp<T>::applyEffect(T* audio, size_t frameCount, const Chann
ReverbDelayLine* linesC = x78_C[c];
ReverbDelayLine* linesAP = x0_AP[c];
float sample = audio[c];
for (int s=1 ; s<160 && f<frameCount ; ++s, ++f)
for (int s=0 ; s<160 && f<frameCount ; ++s, ++f)
{
float sample = audio[s * chanMap.m_channelCount + c];
/* Pre-delay stage */
float sample2 = sample;
if (x120_preDelayTime != 0)
@ -224,8 +225,7 @@ void EffectReverbStdImp<T>::applyEffect(T* audio, size_t frameCount, const Chann
linesAP[1].x4_outPoint = 0;
/* Mix out */
audio[(s-1) * chanMap.m_channelCount + c] = ClampFull<T>(dampWet * allPass + dampDry * sample);
sample = audio[s * chanMap.m_channelCount + c];
audio[s * chanMap.m_channelCount + c] = ClampFull<T>(dampWet * allPass + dampDry * sample);
}
x130_preDelayPtr[c] = preDelayPtr;
}

View File

@ -27,10 +27,10 @@ EffectDelay& Submix::makeDelay(uint32_t initDelay, uint32_t initFeedback, uint32
return makeEffect<EffectDelay>(initDelay, initFeedback, initOutput);
}
EffectReverb& Submix::makeReverbStd(float coloration, float mix, float time,
float damping, float preDelay)
EffectReverbStd& Submix::makeReverbStd(float coloration, float mix, float time,
float damping, float preDelay)
{
return makeEffect<EffectReverb>(coloration, mix, time, damping, preDelay);
return makeEffect<EffectReverbStd>(coloration, mix, time, damping, preDelay);
}
EffectReverbHi& Submix::makeReverbHi(float coloration, float mix, float time,