From 531961be786390d4b931544222548f2b2fd805fe Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 16 May 2016 11:00:37 -1000 Subject: [PATCH] Fix reverb issue --- include/amuse/EffectReverb.hpp | 10 +++++----- include/amuse/Submix.hpp | 4 ++-- lib/EffectReverb.cpp | 16 ++++++++-------- lib/Submix.cpp | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/amuse/EffectReverb.hpp b/include/amuse/EffectReverb.hpp index 8047cf7..e88e67d 100644 --- a/include/amuse/EffectReverb.hpp +++ b/include/amuse/EffectReverb.hpp @@ -28,7 +28,7 @@ template 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 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 using ImpType = EffectReverbStdImp; @@ -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 -class EffectReverbStdImp : public EffectBase, public EffectReverb +class EffectReverbStdImp : public EffectBase, public EffectReverbStd { ReverbDelayLine x0_AP[8][2] = {}; /**< All-pass delay lines */ ReverbDelayLine x78_C[8][2] = {}; /**< Comb delay lines */ diff --git a/include/amuse/Submix.hpp b/include/amuse/Submix.hpp index 111de64..7ed421c 100644 --- a/include/amuse/Submix.hpp +++ b/include/amuse/Submix.hpp @@ -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, diff --git a/lib/EffectReverb.cpp b/lib/EffectReverb.cpp index b2fdc76..34505b2 100644 --- a/lib/EffectReverb.cpp +++ b/lib/EffectReverb.cpp @@ -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 EffectReverbStdImp::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::_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::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::applyEffect(T* audio, size_t frameCount, const Chann linesAP[1].x4_outPoint = 0; /* Mix out */ - audio[(s-1) * chanMap.m_channelCount + c] = ClampFull(dampWet * allPass + dampDry * sample); - sample = audio[s * chanMap.m_channelCount + c]; + audio[s * chanMap.m_channelCount + c] = ClampFull(dampWet * allPass + dampDry * sample); } x130_preDelayPtr[c] = preDelayPtr; } diff --git a/lib/Submix.cpp b/lib/Submix.cpp index e9ead37..f9cae5f 100644 --- a/lib/Submix.cpp +++ b/lib/Submix.cpp @@ -27,10 +27,10 @@ EffectDelay& Submix::makeDelay(uint32_t initDelay, uint32_t initFeedback, uint32 return makeEffect(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(coloration, mix, time, damping, preDelay); + return makeEffect(coloration, mix, time, damping, preDelay); } EffectReverbHi& Submix::makeReverbHi(float coloration, float mix, float time,