44 ProcessorDuplicator (
typename StateType::Ptr stateToUse) : state (std::move (stateToUse)) {}
53 processors.
add (
new MonoProcessorType (state));
58 for (
auto* p : processors)
59 p->prepare (monoSpec);
62 void reset()
noexcept {
for (
auto* p : processors) p->reset(); }
64 template <
typename ProcessContext>
65 void process (
const ProcessContext& context)
noexcept
67 jassert ((
int) context.getInputBlock().getNumChannels() <= processors.
size());
68 jassert ((
int) context.getOutputBlock().getNumChannels() <= processors.
size());
70 auto numChannels =
static_cast<size_t> (jmin (context.getInputBlock().getNumChannels(),
71 context.getOutputBlock().getNumChannels()));
73 for (
size_t chan = 0; chan < numChannels; ++chan)
74 processors[(
int) chan]->process (MonoProcessContext<ProcessContext> (context, chan));
77 typename StateType::Ptr state;
80 template <
typename ProcessContext>
81 struct MonoProcessContext :
public ProcessContext
83 MonoProcessContext (
const ProcessContext& multiChannelContext,
size_t channelToUse)
84 : ProcessContext (multiChannelContext), channel (channelToUse)
89 typename ProcessContext::ConstAudioBlockType getInputBlock()
const noexcept {
return ProcessContext::getInputBlock() .getSingleChannelBlock (channel); }
90 typename ProcessContext::AudioBlockType getOutputBlock()
const noexcept {
return ProcessContext::getOutputBlock().getSingleChannelBlock (channel); }