I’m going to just throw these in here so they don’t get lost in the noise:
class JUCE_API Node : public ReferenceCountedObject
{
public:
//==============================================================================
:
void setBypass (bool bypass) { bypassed = bypass; }
bool isBypassed() const noexcept { return bypassed; }
//==============================================================================
/** A convenient typedef for referring to a pointer to a node object. */
typedef ReferenceCountedObjectPtr<Node> Ptr;
private:
//==============================================================================
friend class AudioProcessorGraph;
const ScopedPointer<AudioProcessor> processor;
bool isPrepared = false;
bool bypassed = false;
:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Node)
};
struct ProcessOp : public RenderingOp
{
:
void callProcess (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
if (processor.isUsingDoublePrecision())
{
tempBufferDouble.makeCopyOf (buffer, true);
if (node->isBypassed())
processor.processBlockBypassed (tempBufferDouble, midiMessages);
else
processor.processBlock (tempBufferDouble, midiMessages);
buffer.makeCopyOf (tempBufferDouble, true);
}
else
{
if (node->isBypassed())
processor.processBlockBypassed (buffer, midiMessages);
else
processor.processBlock (buffer, midiMessages);
}
}
void callProcess (AudioBuffer<double>& buffer, MidiBuffer& midiMessages)
{
if (processor.isUsingDoublePrecision())
{
if (node->isBypassed())
processor.processBlockBypassed (buffer, midiMessages);
else
processor.processBlock (buffer, midiMessages);
}
else
{
tempBufferFloat.makeCopyOf (buffer, true);
if (node->isBypassed())
processor.processBlockBypassed (tempBufferFloat, midiMessages);
else
processor.processBlock (tempBufferFloat, midiMessages);
buffer.makeCopyOf (tempBufferFloat, true);
}
}
:
}
and a public method to be able to refresh the graph externally when one of the processors changes it’s latency:
void refreshGraph() { triggerAsyncUpdate(); }
and finally in createRenderingOpsForNode() change
if (numOuts == 0)
totalLatency = maxLatency;
to:
if (maxLatency > totalLatency)
totalLatency = maxLatency;
Cheers,
Rail