# Amuse: include/amuse/EffectReverb.hpp Source File

EffectReverb.hpp
#ifndef __AMUSE_EFFECTREVERB_HPP__
#define __AMUSE_EFFECTREVERB_HPP__
#include "EffectBase.hpp"
#include "amuse/Common.hpp"
#include <memory>
namespace amuse
{
struct ReverbDelayLine
{
int32_t x0_inPoint = 0;
int32_t x4_outPoint = 0;
int32_t x8_length = 0;
std::unique_ptr<float[]> xc_inputs;
float x10_lastInput = 0.f;
void allocate(int32_t delay);
void setdelay(int32_t delay);
};
template <typename T>
class EffectReverbStdImp;
template <typename T>
class EffectReverbHiImp;
class EffectReverbStd
{
protected:
float x140_x1c8_coloration;
float x144_x1cc_mix;
float x148_x1d0_time;
float x14c_x1d4_damping;
float x150_x1d8_preDelay;
bool m_dirty = true;
template <typename T>
friend class EffectReverbStdImp;
template <typename T>
friend class EffectReverbHiImp;
EffectReverbStd(float coloration, float mix, float time,
float damping, float preDelay);
public:
template <typename T>
using ImpType = EffectReverbStdImp<T>;
void setColoration(float coloration)
{
x140_x1c8_coloration = clamp(0.f, coloration, 1.f);
m_dirty = true;
}
void setMix(float mix)
{
x144_x1cc_mix = clamp(0.f, mix, 1.f);
m_dirty = true;
}
void setTime(float time)
{
x148_x1d0_time = clamp(0.01f, time, 10.f);
m_dirty = true;
}
void setDamping(float damping)
{
x14c_x1d4_damping = clamp(0.f, damping, 1.f);
m_dirty = true;
}
void setPreDelay(float preDelay)
{
x150_x1d8_preDelay = clamp(0.f, preDelay, 0.1f);
m_dirty = true;
}
};
class EffectReverbHi : public EffectReverbStd
{
float x1dc_crosstalk;
template <typename T>
friend class EffectReverbHiImp;
EffectReverbHi(float coloration, float mix, float time,
float damping, float preDelay, float crosstalk);
public:
template <typename T>
using ImpType = EffectReverbHiImp<T>;
void setCrosstalk(float crosstalk)
{
x1dc_crosstalk = clamp(0.f, crosstalk, 1.f);
m_dirty = true;
}
};
template <typename T>
class EffectReverbStdImp : public EffectBase<T>, public EffectReverbStd
{
ReverbDelayLine x0_AP[8][2] = {};
ReverbDelayLine x78_C[8][2] = {};
float xf0_allPassCoef = 0.f;
float xf4_combCoef[8][2] = {};
float x10c_lpLastout[8] = {};
float x118_level = 0.f;
float x11c_damping = 0.f;
int32_t x120_preDelayTime = 0;
std::unique_ptr<float[]> x124_preDelayLine[8];
float* x130_preDelayPtr[8] = {};
double m_sampleRate;
void _update();
public:
EffectReverbStdImp(float coloration, float mix, float time,
float damping, float preDelay, double sampleRate);
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
};
template <typename T>
class EffectReverbHiImp : public EffectBase<T>, public EffectReverbHi
{
ReverbDelayLine x0_AP[8][2] = {};
ReverbDelayLine x78_LP[8] = {};
ReverbDelayLine xb4_C[8][3] = {};
float x168_allPassCoef = 0.f;
float x16c_combCoef[8][3] = {};
float x190_lpLastout[8] = {};
float x19c_level = 0.f;
float x1a0_damping = 0.f;
int32_t x1a4_preDelayTime = 0;
std::unique_ptr<float[]> x1ac_preDelayLine[8];
float* x1b8_preDelayPtr[8] = {};
float x1a8_internalCrosstalk;
double m_sampleRate;
void _update();
void _handleReverb(T* audio, int chanIdx, int chanCount, int sampleCount);
void _doCrosstalk(T* audio, float wet, float dry, int chanCount, int sampleCount);
public:
EffectReverbHiImp(float coloration, float mix, float time,
float damping, float preDelay, float crosstalk, double sampleRate);
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
};
}
#endif // __AMUSE_EFFECTREVERB_HPP__
amuse::EffectReverbStd
Definition: EffectReverb.hpp:31
amuse::EffectReverbHi
Definition: EffectReverb.hpp:83
amuse::EffectReverbHiImp
Definition: EffectReverb.hpp:28
amuse::ReverbDelayLine
Definition: EffectReverb.hpp:12
amuse
Definition: AudioGroup.hpp:8
amuse::EffectReverbStdImp
Definition: EffectReverb.hpp:25
amuse::EffectReverbStd::x144_x1cc_mix
float x144_x1cc_mix
Definition: EffectReverb.hpp:35
amuse::EffectReverbStd::x148_x1d0_time
float x148_x1d0_time
Definition: EffectReverb.hpp:36
amuse::EffectReverbStd::x150_x1d8_preDelay
float x150_x1d8_preDelay
Definition: EffectReverb.hpp:38
amuse::ChannelMap
Definition: IBackendVoice.hpp:22
amuse::EffectReverbStd::x14c_x1d4_damping
float x14c_x1d4_damping
Definition: EffectReverb.hpp:37
amuse::EffectBase
Definition: EffectBase.hpp:18
amuse::EffectReverbStd::x140_x1c8_coloration
float x140_x1c8_coloration
Definition: EffectReverb.hpp:34