34 lines
809 B
C++
34 lines
809 B
C++
|
#include "Sub.hpp"
|
||
|
|
||
|
namespace muz
|
||
|
{
|
||
|
/*explicit*/ Sub::Sub(AudioConf const& conf,
|
||
|
std::unique_ptr<Signal> lhs,
|
||
|
std::unique_ptr<Signal> rhs)
|
||
|
: m_conf { conf }
|
||
|
, m_out_left { std::vector<float>(m_conf.channels(), 0.0f) }
|
||
|
, m_out_right { std::vector<float>(m_conf.channels(), 0.0f) }
|
||
|
, m_lhs { std::move(lhs) }
|
||
|
, m_rhs { std::move(rhs) }
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/*virtual*/ Sub::~Sub()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void Sub::next(std::vector<float>& out) /*override*/
|
||
|
{
|
||
|
m_lhs->next(m_out_left);
|
||
|
m_rhs->next(m_out_right);
|
||
|
|
||
|
assert(m_out_left.size() == m_out_right.size());
|
||
|
assert(m_out_left.size() == static_cast<size_t>(m_conf.channels()));
|
||
|
|
||
|
for (int i=0; i<m_conf.channels(); i++)
|
||
|
{
|
||
|
out[i] = m_out_left[i] - m_out_right[i];
|
||
|
}
|
||
|
}
|
||
|
}
|