2016-05-07 22:10:57 +00:00
|
|
|
#include "amuse/Submix.hpp"
|
|
|
|
|
|
|
|
namespace amuse
|
|
|
|
{
|
|
|
|
|
2016-07-14 04:54:46 +00:00
|
|
|
Submix::Submix(Engine& engine) : m_root(engine) {}
|
2016-05-07 22:10:57 +00:00
|
|
|
|
2016-05-14 04:46:39 +00:00
|
|
|
EffectChorus& Submix::makeChorus(uint32_t baseDelay, uint32_t variation, uint32_t period)
|
2016-05-09 07:22:58 +00:00
|
|
|
{
|
2016-05-14 04:46:39 +00:00
|
|
|
return makeEffect<EffectChorus>(baseDelay, variation, period);
|
2016-05-09 07:22:58 +00:00
|
|
|
}
|
|
|
|
|
2017-01-23 07:21:50 +00:00
|
|
|
EffectChorus& Submix::makeChorus(const EffectChorusInfo& info)
|
|
|
|
{
|
|
|
|
return makeEffect<EffectChorus>(info);
|
|
|
|
}
|
|
|
|
|
2016-05-14 04:46:39 +00:00
|
|
|
EffectDelay& Submix::makeDelay(uint32_t initDelay, uint32_t initFeedback, uint32_t initOutput)
|
2016-05-09 07:22:58 +00:00
|
|
|
{
|
2016-05-14 04:46:39 +00:00
|
|
|
return makeEffect<EffectDelay>(initDelay, initFeedback, initOutput);
|
2016-05-09 07:22:58 +00:00
|
|
|
}
|
|
|
|
|
2017-01-23 07:21:50 +00:00
|
|
|
EffectDelay& Submix::makeDelay(const EffectDelayInfo& info)
|
|
|
|
{
|
|
|
|
return makeEffect<EffectDelay>(info);
|
|
|
|
}
|
|
|
|
|
2016-07-14 04:54:46 +00:00
|
|
|
EffectReverbStd& Submix::makeReverbStd(float coloration, float mix, float time, float damping, float preDelay)
|
2016-05-09 07:22:58 +00:00
|
|
|
{
|
2016-05-16 21:00:37 +00:00
|
|
|
return makeEffect<EffectReverbStd>(coloration, mix, time, damping, preDelay);
|
2016-05-09 07:22:58 +00:00
|
|
|
}
|
|
|
|
|
2017-01-23 07:21:50 +00:00
|
|
|
EffectReverbStd& Submix::makeReverbStd(const EffectReverbStdInfo& info)
|
|
|
|
{
|
|
|
|
return makeEffect<EffectReverbStd>(info);
|
|
|
|
}
|
|
|
|
|
2016-07-14 04:54:46 +00:00
|
|
|
EffectReverbHi& Submix::makeReverbHi(float coloration, float mix, float time, float damping, float preDelay,
|
|
|
|
float crosstalk)
|
2016-05-14 04:46:39 +00:00
|
|
|
{
|
|
|
|
return makeEffect<EffectReverbHi>(coloration, mix, time, damping, preDelay, crosstalk);
|
|
|
|
}
|
|
|
|
|
2017-01-23 07:21:50 +00:00
|
|
|
EffectReverbHi& Submix::makeReverbHi(const EffectReverbHiInfo& info)
|
|
|
|
{
|
|
|
|
return makeEffect<EffectReverbHi>(info);
|
|
|
|
}
|
|
|
|
|
2016-05-14 04:46:39 +00:00
|
|
|
void Submix::applyEffect(int16_t* audio, size_t frameCount, const ChannelMap& chanMap) const
|
|
|
|
{
|
2016-05-14 04:53:53 +00:00
|
|
|
for (const std::unique_ptr<EffectBaseTypeless>& effect : m_effectStack)
|
|
|
|
((EffectBase<int16_t>&)*effect).applyEffect(audio, frameCount, chanMap);
|
2016-05-14 04:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Submix::applyEffect(int32_t* audio, size_t frameCount, const ChannelMap& chanMap) const
|
|
|
|
{
|
2016-05-14 04:53:53 +00:00
|
|
|
for (const std::unique_ptr<EffectBaseTypeless>& effect : m_effectStack)
|
|
|
|
((EffectBase<int32_t>&)*effect).applyEffect(audio, frameCount, chanMap);
|
2016-05-14 04:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Submix::applyEffect(float* audio, size_t frameCount, const ChannelMap& chanMap) const
|
2016-05-09 07:22:58 +00:00
|
|
|
{
|
2016-05-14 04:53:53 +00:00
|
|
|
for (const std::unique_ptr<EffectBaseTypeless>& effect : m_effectStack)
|
|
|
|
((EffectBase<float>&)*effect).applyEffect(audio, frameCount, chanMap);
|
2016-05-09 07:22:58 +00:00
|
|
|
}
|
|
|
|
|
2016-06-01 04:49:35 +00:00
|
|
|
void Submix::resetOutputSampleRate(double sampleRate)
|
|
|
|
{
|
|
|
|
for (const std::unique_ptr<EffectBaseTypeless>& effect : m_effectStack)
|
|
|
|
effect->resetOutputSampleRate(sampleRate);
|
|
|
|
}
|
2016-05-07 22:10:57 +00:00
|
|
|
}
|