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

EffectChorus.hpp
#ifndef __AMUSE_EFFECTCHORUS_HPP__
#define __AMUSE_EFFECTCHORUS_HPP__
#include "EffectBase.hpp"
#include "Common.hpp"
#include <stdint.h>
namespace amuse
{
template <typename T>
class EffectChorusImp;
#define AMUSE_CHORUS_NUM_BLOCKS 3
class EffectChorus
{
uint32_t x90_baseDelay;
uint32_t x94_variation;
uint32_t x98_period;
bool m_dirty = true;
template <typename T>
friend class EffectChorusImp;
EffectChorus(uint32_t baseDelay, uint32_t variation, uint32_t period);
public:
template <typename T>
using ImpType = EffectChorusImp<T>;
void setBaseDelay(uint32_t baseDelay)
{
baseDelay = clamp(5u, baseDelay, 15u);
x90_baseDelay = baseDelay;
m_dirty = true;
}
void setVariation(uint32_t variation)
{
variation = clamp(0u, variation, 5u);
x94_variation = variation;
m_dirty = true;
}
void setPeriod(uint32_t period)
{
period = clamp(500u, period, 10000u);
x98_period = period;
m_dirty = true;
}
};
template <typename T>
class EffectChorusImp : public EffectBase<T>, public EffectChorus
{
T* x0_lastChans[8][AMUSE_CHORUS_NUM_BLOCKS];
uint8_t x24_currentLast = 1;
T x28_oldChans[8][4] = {};
uint32_t x58_currentPosLo = 0;
uint32_t x5c_currentPosHi = 0;
int32_t x60_pitchOffset;
uint32_t x64_pitchOffsetPeriodCount;
uint32_t x68_pitchOffsetPeriod;
struct SrcInfo
{
T* x6c_dest;
T* x70_smpBase;
T* x74_old;
uint32_t x78_posLo;
uint32_t x7c_posHi;
uint32_t x80_pitchLo;
uint32_t x84_pitchHi;
uint32_t x88_trigger;
uint32_t x8c_target = 0;
void doSrc1(size_t blockSamples, size_t chanCount);
void doSrc2(size_t blockSamples, size_t chanCount);
} x6c_src;
uint32_t m_sampsPerMs;
uint32_t m_blockSamples;
void _update();
public:
~EffectChorusImp();
EffectChorusImp(uint32_t baseDelay, uint32_t variation, uint32_t period, double sampleRate);
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
};
}
#endif // __AMUSE_EFFECTCHORUS_HPP__
amuse::EffectChorusImp
Definition: EffectChorus.hpp:11
amuse
Definition: AudioGroup.hpp:8
amuse::EffectChorus
Definition: EffectChorus.hpp:16
amuse::ChannelMap
Definition: IBackendVoice.hpp:22
amuse::EffectBase
Definition: EffectBase.hpp:18