#include <vector>
, APF_MIMOPROCESSOR_INTERFACE_POLICY>
{
public:
class Input : public MimoProcessorBase::Input
{
public:
using iterator = std::vector<sample_type>::const_iterator;
explicit Input(const Params& p)
: MimoProcessorBase::Input(p)
, _buffer(this->parent.block_size())
{}
{
std::copy(this->buffer.begin(), this->buffer.end(), _buffer.begin());
}
iterator begin() const { return _buffer.begin(); }
iterator end() const { return _buffer.end(); }
private:
std::vector<sample_type> _buffer;
};
class Output;
~SimpleProcessor() { this->deactivate(); }
};
class SimpleProcessor::Output : public MimoProcessorBase::DefaultOutput
{
public:
using typename MimoProcessorBase::Output::Params;
explicit Output(const Params& p)
: MimoProcessorBase::DefaultOutput(p)
, _combiner(this->parent.get_input_list(), *this)
{}
{
float weight = 1.0f / float(this->parent.get_input_list().size());
_combiner.process(simple_predicate(weight));
}
private:
class simple_predicate
{
public:
explicit simple_predicate(float weight)
: _weight(weight)
{}
apf::CombineChannelsResult::type select(const Input&)
{
return apf::CombineChannelsResult::constant;
}
float operator()(float in)
{
return in * _weight;
}
private:
float _weight;
};
};
: MimoProcessorBase(p)
{
Input::Params ip;
std::string in_port_prefix = p.
get(
"in_port_prefix",
"");
int in_ch = p.
get<
int>(
"in_channels");
for (int i = 1; i <= in_ch; ++i)
{
ip.set("id", i);
if (in_port_prefix != "")
{
}
this->add(ip);
}
Output::Params op;
std::string out_port_prefix = p.
get(
"out_port_prefix",
"");
auto out_ch = p.
get<
int>(
"out_channels");
for (int i = 1; i <= out_ch; ++i)
{
op.set("id", i);
if (out_port_prefix != "")
{
}
this->add(op);
}
this->activate();
}
Combine channels: transform and accumulate.
Multi-threaded multiple-input-multiple-output (MIMO) processor.
Combine channels, interpolate, crossfade.
Multi-threaded MIMO (multiple input, multiple output) processor.
#define APF_PROCESS(name, parent)
Macro to create a Process struct and a corresponding member function.
Miscellaneous helper classes.
std::string A2S(const T &input)
Converter "Anything to String".
A "dictionary" for parameters.
T get(const std::string &k, const T &def) const
Get value converted to given type.