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