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

EffectDelay.hpp
#ifndef __AMUSE_EFFECTDELAY_HPP__
#define __AMUSE_EFFECTDELAY_HPP__
#include "EffectBase.hpp"
#include "Common.hpp"
#include <stdint.h>
#include <memory>
namespace amuse
{
template <typename T>
class EffectDelayImp;
class EffectDelay
{
protected:
uint32_t x3c_delay[8];
uint32_t x48_feedback[8];
uint32_t x54_output[8];
bool m_dirty = true;
public:
template <typename T>
using ImpType = EffectDelayImp<T>;
void setDelay(uint32_t delay)
{
delay = clamp(10u, delay, 5000u);
for (int i=0 ; i<8 ; ++i)
x3c_delay[i] = delay;
m_dirty = true;
}
void setChanDelay(int chanIdx, uint32_t delay)
{
delay = clamp(10u, delay, 5000u);
x3c_delay[chanIdx] = delay;
m_dirty = true;
}
void setFeedback(uint32_t feedback)
{
feedback = clamp(0u, feedback, 100u);
for (int i=0 ; i<8 ; ++i)
x48_feedback[i] = feedback;
m_dirty = true;
}
void setChanFeedback(int chanIdx, uint32_t feedback)
{
feedback = clamp(0u, feedback, 100u);
x48_feedback[chanIdx] = feedback;
m_dirty = true;
}
void setOutput(uint32_t output)
{
output = clamp(0u, output, 100u);
for (int i=0 ; i<8 ; ++i)
x54_output[i] = output;
m_dirty = true;
}
void setChanOutput(int chanIdx, uint32_t output)
{
output = clamp(0u, output, 100u);
x54_output[chanIdx] = output;
m_dirty = true;
}
};
template <typename T>
class EffectDelayImp : public EffectBase<T>, public EffectDelay
{
uint32_t x0_currentSize[8];
uint32_t xc_currentPos[8];
uint32_t x18_currentFeedback[8];
uint32_t x24_currentOutput[8];
std::unique_ptr<T[]> x30_chanLines[8];
uint32_t m_sampsPerMs;
uint32_t m_blockSamples;
void _update();
public:
EffectDelayImp(uint32_t initDelay, uint32_t initFeedback, uint32_t initOutput, double sampleRate);
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
};
}
#endif // __AMUSE_EFFECTDELAY_HPP__
amuse::EffectDelayImp
Definition: EffectDelay.hpp:12
amuse::EffectDelay::m_dirty
bool m_dirty
Definition: EffectDelay.hpp:21
amuse::EffectDelay::x48_feedback
uint32_t x48_feedback[8]
Definition: EffectDelay.hpp:19
amuse::EffectDelay
Definition: EffectDelay.hpp:15
amuse
Definition: AudioGroup.hpp:8
amuse::EffectDelay::x3c_delay
uint32_t x3c_delay[8]
Definition: EffectDelay.hpp:18
amuse::ChannelMap
Definition: IBackendVoice.hpp:22
amuse::EffectBase
Definition: EffectBase.hpp:18
amuse::EffectDelay::x54_output
uint32_t x54_output[8]
Definition: EffectDelay.hpp:20