tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
tracktion::graph::Node Class Referenceabstract

Main graph Node processor class. More...

#include "tracktion_Node.h"

Inheritance diagram for tracktion::graph::Node:
tracktion::engine::ArrangerLauncherSwitchingNode tracktion::engine::ClickNode tracktion::engine::CombiningNode tracktion::engine::ContainerClipNode tracktion::engine::DynamicOffsetNode tracktion::engine::FadeInOutNode tracktion::engine::HoldingNode tracktion::engine::HostedMidiInputDeviceNode tracktion::engine::InputNode tracktion::engine::InputProviderFillerNode tracktion::engine::InsertNode tracktion::engine::InsertSendNode tracktion::engine::LevelMeasurerProcessingNode tracktion::engine::LevelMeasuringNode tracktion::engine::LiveMidiInjectingNode tracktion::engine::LiveMidiOutputNode tracktion::engine::LoopingMidiNode tracktion::engine::MelodyneNode tracktion::engine::MidiInputDeviceNode tracktion::engine::MidiNode tracktion::engine::MidiOutputDeviceInstanceInjectingNode tracktion::engine::ModifierNode tracktion::engine::PlayHeadPositionNode tracktion::engine::PluginNode tracktion::engine::RackInstanceNode tracktion::engine::RackReturnNode tracktion::engine::SharedLevelMeasuringNode tracktion::engine::SlotControlNode tracktion::engine::SpeedRampWaveNode tracktion::engine::TimeStretchingWaveNode tracktion::engine::TimedMutingNode tracktion::engine::TrackMidiInputDeviceNode tracktion::engine::TrackMutingNode tracktion::engine::TrackWaveInputDeviceNode tracktion::engine::WaveInputDeviceNode tracktion::engine::WaveNode tracktion::engine::WaveNodeRealTime tracktion::graph::BasicSummingNode tracktion::graph::ChannelRemappingNode tracktion::graph::ConnectedNode tracktion::graph::ForwardingNode tracktion::graph::FunctionNode tracktion::graph::GainNode tracktion::graph::LatencyNode tracktion::graph::MidiNode tracktion::graph::ReturnNode tracktion::graph::SendNode tracktion::graph::SilentNode tracktion::graph::SinNode tracktion::graph::SinkNode tracktion::graph::SummingNode

Classes

struct  AudioAndMidiBuffer
 Contains the buffers for a processing operation. More...
 
struct  ProcessContext
 Struct to describe a single iteration of a process call. More...
 

Public Member Functions

void initialise (const PlaybackInitialisationInfo &)
 Call once after the graph has been constructed to initialise buffers etc.
 
void prepareForNextBlock (juce::Range< int64_t > referenceSampleRange)
 Call before processing the next block, used to reset the process status.
 
void process (choc::buffer::FrameCount numSamples, juce::Range< int64_t > referenceSampleRange)
 Call to process the node, which will in turn call the process method with the buffers to fill.
 
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.
 
virtual TransformResult transform (Node &, const std::vector< Node * > &, TransformCache &)
 Called after construction to give the node a chance to modify its topology.
 
virtual std::vector< Node * > getDirectInputNodes ()
 Should return all the inputs directly feeding in to this node.
 
virtual std::vector< Node * > getInternalNodes ()
 Can return Nodes that are internal to this Node but don't make up the main graph constructed from getDirectInputNodes().
 
virtual NodeProperties getNodeProperties ()=0
 Should return the properties of the node.
 
virtual bool isReadyToProcess ()=0
 Should return true when this node is ready to be processed.
 
void retain ()
 Retains the buffers so they won't be deallocated after the Node has processed.
 
void release ()
 Releases the buffers allowing internal storage to be deallocated.
 
virtual size_t getAllocatedBytes () const
 
void enablePreProcess (bool)
 

Public Attributes

void * internal
 
int numOutputNodes
 

Protected Member Functions

virtual void prepareToPlay (const PlaybackInitialisationInfo &)
 Called once before playback begins for each node.
 
virtual void prefetchBlock (juce::Range< int64_t >)
 Called before once on all Nodes before they are processed.
 
virtual void process (ProcessContext &)=0
 Called when the node is to be processed.
 
virtual void preProcess (choc::buffer::FrameCount, juce::Range< int64_t >)
 Called when the node is to be processed, just before process.
 
void setOptimisations (NodeOptimisations)
 This can be called to provide some hints about allocating or playing back a Node to improve efficiency.
 
void setBufferViewToUse (Node *sourceNode, const choc::buffer::ChannelArrayView< float > &)
 This can be called during prepareToPlay to set a BufferView to use which can improve efficiency.
 
void setAudioOutput (Node *sourceNode, const choc::buffer::ChannelArrayView< float > &)
 This can be called during your process function to set a view to the output.
 

Detailed Description

Main graph Node processor class.

Nodes are combined together to form a graph with a root Node which can then be initialsed and processed.

Subclasses should implement the various virtual methods but never call these directly. They will be called automatically by the non-virtual methods.

Definition at line 216 of file tracktion_Node.h.


Class Documentation

◆ tracktion::graph::Node::AudioAndMidiBuffer

struct tracktion::graph::Node::AudioAndMidiBuffer

Contains the buffers for a processing operation.

Definition at line 245 of file tracktion_Node.h.

Class Members
ChannelArrayView< float > audio
MidiMessageArray & midi

◆ tracktion::graph::Node::ProcessContext

struct tracktion::graph::Node::ProcessContext

Struct to describe a single iteration of a process call.

Definition at line 302 of file tracktion_Node.h.

Class Members
AudioAndMidiBuffer buffers
FrameCount numSamples
Range< int64_t > referenceSampleRange

Member Function Documentation

◆ getAllocatedBytes()

size_t tracktion::graph::Node::getAllocatedBytes ( ) const
virtual

Definition at line 594 of file tracktion_Node.h.

◆ getDirectInputNodes()

virtual std::vector< Node * > tracktion::graph::Node::getDirectInputNodes ( )
virtual

Should return all the inputs directly feeding in to this node.

Reimplemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::ClickNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::FadeInOutNode, tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::LevelMeasuringNode, tracktion::engine::LiveMidiInjectingNode, tracktion::engine::LiveMidiOutputNode, tracktion::engine::MelodyneNode, tracktion::engine::MidiOutputDeviceInstanceInjectingNode, tracktion::engine::ModifierNode, tracktion::engine::PlayHeadPositionNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::InputProviderFillerNode, tracktion::engine::InputNode, tracktion::engine::HoldingNode, tracktion::engine::RackReturnNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, tracktion::engine::TimedMutingNode, tracktion::engine::TimeStretchingWaveNode, tracktion::engine::TrackMidiInputDeviceNode, tracktion::engine::TrackMutingNode, tracktion::engine::TrackWaveInputDeviceNode, tracktion::graph::ConnectedNode, tracktion::graph::LatencyNode, tracktion::graph::SummingNode, tracktion::graph::BasicSummingNode, tracktion::graph::FunctionNode, tracktion::graph::GainNode, tracktion::graph::SendNode, tracktion::graph::ReturnNode, tracktion::graph::ChannelRemappingNode, tracktion::graph::SinkNode, and tracktion::graph::ForwardingNode.

Definition at line 280 of file tracktion_Node.h.

◆ getInternalNodes()

virtual std::vector< Node * > tracktion::graph::Node::getInternalNodes ( )
virtual

Can return Nodes that are internal to this Node but don't make up the main graph constructed from getDirectInputNodes().

Most uses cases won't need to implement this but it could be used in situations where sub-graphs are created and processed internally to a Node but other Nodes in a graph still need to have access to them. This call can make them visible.

Reimplemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, and tracktion::engine::DynamicOffsetNode.

Definition at line 289 of file tracktion_Node.h.

◆ getNodeProperties()

virtual NodeProperties tracktion::graph::Node::getNodeProperties ( )
pure virtual

Should return the properties of the node.

This should not be called until after initialise.

Implemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::AuxSendNode, tracktion::engine::ClickNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::FadeInOutNode, tracktion::engine::HostedMidiInputDeviceNode, tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::LevelMeasuringNode, tracktion::engine::LiveMidiInjectingNode, tracktion::engine::LiveMidiOutputNode, tracktion::engine::LoopingMidiNode, tracktion::engine::MelodyneNode, tracktion::engine::MidiInputDeviceNode, tracktion::engine::MidiNode, tracktion::engine::MidiOutputDeviceInstanceInjectingNode, tracktion::engine::ModifierNode, tracktion::engine::PlayHeadPositionNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::InputProviderFillerNode, tracktion::engine::InputNode, tracktion::engine::HoldingNode, tracktion::engine::RackReturnNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, tracktion::engine::SpeedRampWaveNode, tracktion::engine::TimedMutingNode, tracktion::engine::TimeStretchingWaveNode, tracktion::engine::TrackMidiInputDeviceNode, tracktion::engine::TrackMutingNode, tracktion::engine::TrackWaveInputDeviceNode, tracktion::engine::WaveInputDeviceNode, tracktion::engine::WaveNode, tracktion::engine::WaveNodeRealTime, tracktion::graph::ConnectedNode, tracktion::graph::LatencyNode, tracktion::graph::SummingNode, tracktion::graph::MidiNode, tracktion::graph::SinNode, tracktion::graph::SilentNode, tracktion::graph::BasicSummingNode, tracktion::graph::FunctionNode, tracktion::graph::GainNode, tracktion::graph::SendNode, tracktion::graph::ReturnNode, tracktion::graph::ChannelRemappingNode, tracktion::graph::SinkNode, and tracktion::graph::ForwardingNode.

◆ getProcessedOutput()

Node::AudioAndMidiBuffer tracktion::graph::Node::getProcessedOutput ( )

Returns the processed audio and MIDI output.

Must only be called after hasProcessed returns true.

Definition at line 581 of file tracktion_Node.h.

◆ hasProcessed()

bool tracktion::graph::Node::hasProcessed ( ) const

Returns true if this node has processed and its outputs can be retrieved.

Definition at line 576 of file tracktion_Node.h.

◆ initialise()

void tracktion::graph::Node::initialise ( const PlaybackInitialisationInfo info)

Call once after the graph has been constructed to initialise buffers etc.

Definition at line 464 of file tracktion_Node.h.

◆ isReadyToProcess()

virtual bool tracktion::graph::Node::isReadyToProcess ( )
pure virtual

Should return true when this node is ready to be processed.

This is usually when its input's output buffers are ready.

Implemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::ClickNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::FadeInOutNode, tracktion::engine::HostedMidiInputDeviceNode, tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::LevelMeasuringNode, tracktion::engine::LiveMidiInjectingNode, tracktion::engine::LiveMidiOutputNode, tracktion::engine::LoopingMidiNode, tracktion::engine::MelodyneNode, tracktion::engine::MidiInputDeviceNode, tracktion::engine::MidiNode, tracktion::engine::MidiOutputDeviceInstanceInjectingNode, tracktion::engine::ModifierNode, tracktion::engine::PlayHeadPositionNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::InputProviderFillerNode, tracktion::engine::InputNode, tracktion::engine::HoldingNode, tracktion::engine::RackReturnNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, tracktion::engine::SpeedRampWaveNode, tracktion::engine::TimedMutingNode, tracktion::engine::TimeStretchingWaveNode, tracktion::engine::TrackMidiInputDeviceNode, tracktion::engine::TrackMutingNode, tracktion::engine::TrackWaveInputDeviceNode, tracktion::engine::WaveInputDeviceNode, tracktion::engine::WaveNode, tracktion::engine::WaveNodeRealTime, tracktion::graph::ConnectedNode, tracktion::graph::LatencyNode, tracktion::graph::SummingNode, tracktion::graph::MidiNode, tracktion::graph::SinNode, tracktion::graph::SilentNode, tracktion::graph::BasicSummingNode, tracktion::graph::FunctionNode, tracktion::graph::GainNode, tracktion::graph::SendNode, tracktion::graph::ReturnNode, tracktion::graph::ChannelRemappingNode, tracktion::graph::SinkNode, and tracktion::graph::ForwardingNode.

◆ prefetchBlock()

virtual void tracktion::graph::Node::prefetchBlock ( juce::Range< int64_t )
protectedvirtual

Called before once on all Nodes before they are processed.

This can be used to prefetch audio data or update mute statuses etc..

Reimplemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::CombiningNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::PluginNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, and tracktion::engine::TrackMutingNode.

Definition at line 341 of file tracktion_Node.h.

◆ prepareForNextBlock()

void tracktion::graph::Node::prepareForNextBlock ( juce::Range< int64_t referenceSampleRange)

Call before processing the next block, used to reset the process status.

Definition at line 485 of file tracktion_Node.h.

◆ prepareToPlay()

virtual void tracktion::graph::Node::prepareToPlay ( const PlaybackInitialisationInfo )
protectedvirtual

Called once before playback begins for each node.

Use this to allocate buffers etc. This step can be used to modify the topology of the graph (i.e. add/remove nodes). However, if you do this, you must make sure to call initialise on them so they are fully prepared for processing.

Reimplemented in tracktion::engine::WaveNodeRealTime, tracktion::graph::ConnectedNode, tracktion::graph::LatencyNode, tracktion::graph::SummingNode, tracktion::graph::MidiNode, tracktion::graph::SinNode, tracktion::graph::SilentNode, tracktion::engine::AuxSendNode, tracktion::engine::ClickNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::HostedMidiInputDeviceNode, tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::LiveMidiInjectingNode, tracktion::engine::LiveMidiOutputNode, tracktion::engine::LoopingMidiNode, tracktion::engine::MelodyneNode, tracktion::engine::MidiInputDeviceNode, tracktion::engine::MidiNode, tracktion::engine::MidiOutputDeviceInstanceInjectingNode, tracktion::engine::ModifierNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::InputProviderFillerNode, tracktion::engine::InputNode, tracktion::engine::RackReturnNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, tracktion::engine::SpeedRampWaveNode, tracktion::engine::TimedMutingNode, tracktion::engine::TimeStretchingWaveNode, tracktion::engine::TrackMidiInputDeviceNode, tracktion::engine::TrackMutingNode, tracktion::engine::TrackWaveInputDeviceNode, tracktion::engine::WaveInputDeviceNode, tracktion::engine::WaveNode, tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::PlayHeadPositionNode, and tracktion::graph::ReturnNode.

Definition at line 336 of file tracktion_Node.h.

◆ preProcess()

virtual void tracktion::graph::Node::preProcess ( choc::buffer::FrameCount  ,
juce::Range< int64_t  
)
protectedvirtual

Called when the node is to be processed, just before process.

You shouldn't normally have to use this but it gives Nodes an opportunity to perform optimisations like steal input buffers from source if appropriate.

Reimplemented in tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::RackReturnNode, tracktion::engine::TrackMutingNode, and tracktion::graph::ReturnNode.

Definition at line 352 of file tracktion_Node.h.

◆ process() [1/2]

void tracktion::graph::Node::process ( choc::buffer::FrameCount  numSamples,
juce::Range< int64_t referenceSampleRange 
)

Call to process the node, which will in turn call the process method with the buffers to fill.

Parameters
numSamplesThe number of samples that need to be processed.
referenceSampleRangeThe monotonic stream time in samples. This will be passed to the ProcessContext during the process callback so nodes can use this to determine file reading positions etc. Some nodes may ignore this completely. N.B. the length of this may be different to the number of samples to be processed so don't rely on them being the same!

Definition at line 503 of file tracktion_Node.h.

◆ process() [2/2]

virtual void tracktion::graph::Node::process ( ProcessContext )
protectedpure virtual

Called when the node is to be processed.

This should add in to the buffers available making sure not to change their size at all.

Implemented in tracktion::engine::ArrangerLauncherSwitchingNode, tracktion::engine::AuxSendNode, tracktion::engine::ClickNode, tracktion::engine::CombiningNode, tracktion::engine::ContainerClipNode, tracktion::engine::DynamicOffsetNode, tracktion::engine::FadeInOutNode, tracktion::engine::HostedMidiInputDeviceNode, tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::LiveMidiInjectingNode, tracktion::engine::LiveMidiOutputNode, tracktion::engine::LoopingMidiNode, tracktion::engine::MelodyneNode, tracktion::engine::MidiInputDeviceNode, tracktion::engine::MidiNode, tracktion::engine::MidiOutputDeviceInstanceInjectingNode, tracktion::engine::ModifierNode, tracktion::engine::PluginNode, tracktion::engine::RackInstanceNode, tracktion::engine::InputProviderFillerNode, tracktion::engine::HoldingNode, tracktion::engine::RackReturnNode, tracktion::engine::SharedLevelMeasuringNode, tracktion::engine::SlotControlNode, tracktion::engine::SpeedRampWaveNode, tracktion::engine::TimedMutingNode, tracktion::engine::TimeStretchingWaveNode, tracktion::engine::TrackMidiInputDeviceNode, tracktion::engine::TrackMutingNode, tracktion::engine::TrackWaveInputDeviceNode, tracktion::engine::WaveInputDeviceNode, tracktion::engine::WaveNode, tracktion::engine::WaveNodeRealTime, tracktion::graph::ConnectedNode, tracktion::graph::SinkNode, tracktion::engine::LevelMeasurerProcessingNode, tracktion::engine::PlayHeadPositionNode, tracktion::engine::InputNode, tracktion::graph::LatencyNode, tracktion::graph::SummingNode, tracktion::graph::MidiNode, tracktion::graph::SinNode, tracktion::graph::SilentNode, tracktion::graph::BasicSummingNode, tracktion::graph::FunctionNode, tracktion::graph::GainNode, tracktion::graph::SendNode, tracktion::graph::ReturnNode, tracktion::graph::ChannelRemappingNode, tracktion::graph::ForwardingNode, and tracktion::engine::LevelMeasuringNode.

◆ release()

void tracktion::graph::Node::release ( )

Releases the buffers allowing internal storage to be deallocated.

You shouldn't normally need to call this unles your Node player has special requirements.

Definition at line 637 of file tracktion_Node.h.

◆ retain()

void tracktion::graph::Node::retain ( )

Retains the buffers so they won't be deallocated after the Node has processed.

You shouldn't normally need to call this unles your Node player has special requirements.

Definition at line 631 of file tracktion_Node.h.

◆ setAudioOutput()

void tracktion::graph::Node::setAudioOutput ( Node sourceNode,
const choc::buffer::ChannelArrayView< float > &  newAudioView 
)
protected

This can be called during your process function to set a view to the output.

This is useful to avoid having to allocate an internal buffer and always fill it if you're just passing on data.

Definition at line 616 of file tracktion_Node.h.

◆ setBufferViewToUse()

void tracktion::graph::Node::setBufferViewToUse ( Node sourceNode,
const choc::buffer::ChannelArrayView< float > &  view 
)
protected

This can be called during prepareToPlay to set a BufferView to use which can improve efficiency.

Be careful with this. It's intended to use an input buffer as the internal buffer for this Node but that can only be done if the input Node only has a single output (or this Node doesn't write to it).

Definition at line 605 of file tracktion_Node.h.

◆ setOptimisations()

void tracktion::graph::Node::setOptimisations ( NodeOptimisations  newOptimisations)
protected

This can be called to provide some hints about allocating or playing back a Node to improve efficiency.

Be careful with these as they change the default and often expected behaviour.

Definition at line 600 of file tracktion_Node.h.

◆ transform()

virtual TransformResult tracktion::graph::Node::transform ( Node ,
const std::vector< Node * > &  ,
TransformCache  
)
virtual

Called after construction to give the node a chance to modify its topology.

This should return true if any changes were made to the topology as this indicates that the method may need to be called again after other nodes have had their toplogy changed.

Parameters
postOrderedNodesThis is an ordered list obtained from visiting all the Nodes and can be used for quicker introspection of the graph
TransformCacheA cache which can be used to speed up operations during the transform stage.
Returns
TransformResult The type of transformation that has taken place. If connections have been made AND nodes deleted, return nodesDeleted

Reimplemented in tracktion::engine::InsertNode, tracktion::engine::InsertSendNode, tracktion::engine::RackReturnNode, tracktion::graph::ConnectedNode, tracktion::graph::SummingNode, and tracktion::graph::ReturnNode.

Definition at line 272 of file tracktion_Node.h.

Member Data Documentation

◆ internal

void* tracktion::graph::Node::internal

Definition at line 324 of file tracktion_Node.h.

◆ numOutputNodes

int tracktion::graph::Node::numOutputNodes

Definition at line 325 of file tracktion_Node.h.


The documentation for this class was generated from the following file: