13namespace tracktion {
inline namespace graph
24 ownedInput = std::move (inputNode);
27 tracktion::graph::AllocateAudioBuffer::yes });
33 sharedInput = std::move (inputNode);
36 tracktion::graph::AllocateAudioBuffer::yes });
42 latencyProcessor->setLatencyNumSamples (numSamplesToDelay);
45 tracktion::graph::AllocateAudioBuffer::yes });
51 props.latencyNumSamples += latencyProcessor->getLatencyNumSamples();
53 constexpr size_t latencyNodeMagicHash =
size_t (0x95ab5e9dcc);
55 if (props.nodeID != 0)
56 hash_combine (props.nodeID, latencyNodeMagicHash);
73 latencyProcessor->prepareToPlay (info.sampleRate, info.blockSize,
getNodeProperties().numberOfChannels);
74 replaceLatencyProcessorIfPossible (info.nodeGraphToReplace);
81 auto numSamples = (
int) pc.referenceSampleRange.
getLength();
82 jassert (pc.buffers.audio.getNumChannels() == 0 || numSamples == (
int) pc.buffers.audio.getNumFrames());
84 latencyProcessor->writeAudio (inputBuffer);
85 latencyProcessor->writeMIDI (inputMidi);
87 pc.buffers.midi.clear();
88 latencyProcessor->readAudioOverwriting (pc.buffers.audio);
89 latencyProcessor->readMIDI (pc.buffers.midi, numSamples);
95 Node* input =
nullptr;
98 void replaceLatencyProcessorIfPossible (
NodeGraph* nodeGraphToReplace)
100 if (nodeGraphToReplace ==
nullptr)
105 if (nodeIDToLookFor == 0)
108 if (
auto oldNode = findNodeWithID<LatencyNode> (*nodeGraphToReplace, nodeIDToLookFor))
109 if (latencyProcessor->hasSameConfigurationAs (*oldNode->latencyProcessor))
110 latencyProcessor = oldNode->latencyProcessor;
constexpr ValueType getLength() const noexcept
void prepareToPlay(const PlaybackInitialisationInfo &info) override
Called once before playback begins for each node.
NodeProperties getNodeProperties() override
Should return the properties of the node.
std::vector< Node * > getDirectInputNodes() override
Should return all the inputs directly feeding in to this node.
void process(ProcessContext &pc) override
Called when the node is to be processed.
bool isReadyToProcess() override
Should return true when this node is ready to be processed.
Main graph Node processor class.
virtual NodeProperties getNodeProperties()=0
Should return the properties of the node.
void setOptimisations(NodeOptimisations)
This can be called to provide some hints about allocating or playing back a Node to improve efficienc...
bool hasProcessed() const
Returns true if this node has processed and its outputs can be retrieved.
AudioAndMidiBuffer getProcessedOutput()
Returns the processed audio and MIDI output.
Struct to describe a single iteration of a process call.
Holds a graph in an order ready for processing and a sorted map for quick lookups.
Holds some really basic properties of a node.
Passed into Nodes when they are being initialised, to give them useful contextual information that th...