mirror of https://github.com/AxioDL/amuse.git
Add public APIs to current effects so far
This commit is contained in:
parent
ae624795be
commit
6e692c7a89
|
@ -2,6 +2,7 @@
|
||||||
#define __AMUSE_EFFECTCHORUS_HPP__
|
#define __AMUSE_EFFECTCHORUS_HPP__
|
||||||
|
|
||||||
#include "EffectBase.hpp"
|
#include "EffectBase.hpp"
|
||||||
|
#include "Common.hpp"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace amuse
|
namespace amuse
|
||||||
|
@ -55,6 +56,27 @@ public:
|
||||||
~EffectChorus();
|
~EffectChorus();
|
||||||
EffectChorus(uint32_t baseDelay, uint32_t variation, uint32_t period, double sampleRate);
|
EffectChorus(uint32_t baseDelay, uint32_t variation, uint32_t period, double sampleRate);
|
||||||
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
|
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define __AMUSE_EFFECTDELAY_HPP__
|
#define __AMUSE_EFFECTDELAY_HPP__
|
||||||
|
|
||||||
#include "EffectBase.hpp"
|
#include "EffectBase.hpp"
|
||||||
|
#include "Common.hpp"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ class EffectDelay : public EffectBase<T>
|
||||||
uint32_t x18_currentFeedback[8]; /**< [0, 128] feedback attenuator */
|
uint32_t x18_currentFeedback[8]; /**< [0, 128] feedback attenuator */
|
||||||
uint32_t x24_currentOutput[8]; /**< [0, 128] total attenuator */
|
uint32_t x24_currentOutput[8]; /**< [0, 128] total attenuator */
|
||||||
|
|
||||||
std::unique_ptr<T[]> x30_chanLines[8];
|
std::unique_ptr<T[]> x30_chanLines[8]; /**< delay-line buffers for each channel */
|
||||||
|
|
||||||
uint32_t x3c_delay[8]; /**< [10, 5000] time in ms of each channel's delay */
|
uint32_t x3c_delay[8]; /**< [10, 5000] time in ms of each channel's delay */
|
||||||
uint32_t x48_feedback[8]; /**< [0, 100] percent to mix delayed signal with input signal */
|
uint32_t x48_feedback[8]; /**< [0, 100] percent to mix delayed signal with input signal */
|
||||||
|
@ -30,6 +31,48 @@ class EffectDelay : public EffectBase<T>
|
||||||
public:
|
public:
|
||||||
EffectDelay(uint32_t initDelay, uint32_t initFeedback, uint32_t initOutput, double sampleRate);
|
EffectDelay(uint32_t initDelay, uint32_t initFeedback, uint32_t initOutput, double sampleRate);
|
||||||
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
|
void applyEffect(T* audio, size_t frameCount, const ChannelMap& chanMap);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue