TracktionEngine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
graph::NodePlayer Class Reference

Simple player for an Node. More...

#include <tracktion_NodePlayer.h>

Public Member Functions

 NodePlayer ()=default
 Creates an empty NodePlayer.
 
 NodePlayer (std::unique_ptr< Node > nodeToProcess, PlayHeadState *playHeadStateToUse=nullptr)
 Creates an NodePlayer to process a Node.
 
NodegetNode ()
 Returns the current Node.
 
void setNode (std::unique_ptr< Node > newNode)
 Sets the Node to process.
 
void setNode (std::unique_ptr< Node > newNode, double sampleRateToUse, int blockSizeToUse)
 Sets the Node to process with a new sample rate and block size.
 
void prepareToPlay (double sampleRateToUse, int blockSizeToUse)
 Prepares the current Node to be played.
 
std::unique_ptr< NodeGraphprepareToPlay (std::unique_ptr< Node > node, NodeGraph *oldGraph, double sampleRateToUse, int blockSizeToUse)
 Prepares a specific Node to be played and returns all the Nodes.
 
int process (const Node::ProcessContext &pc)
 Processes a block of audio and MIDI data.
 
double getSampleRate () const
 
int processPostorderedNodes (NodeGraph &graphToProcess, const Node::ProcessContext &pc)
 

Protected Member Functions

int processWithPlayHeadState (PlayHeadState &phs, NodeGraph &graphToProcess, const Node::ProcessContext &pc)
 

Static Protected Member Functions

static int processPostorderedNodesSingleThreaded (NodeGraph &nodeGraph, const Node::ProcessContext &pc)
 Processes a group of Nodes assuming a postordering VertexOrdering.
 

Protected Attributes

std::unique_ptr< Nodeinput
 
std::unique_ptr< NodeGraphnodeGraph
 
PlayHeadStateplayHeadState = nullptr
 
double sampleRate = 0.0
 
int blockSize = 0
 
juce::SpinLock inputAndNodesLock
 

Detailed Description

Simple player for an Node.

This simply iterate all the nodes attempting to process them in a single thread.

Constructor & Destructor Documentation

◆ NodePlayer() [1/2]

graph::NodePlayer::NodePlayer ( )
default

Creates an empty NodePlayer.

◆ NodePlayer() [2/2]

graph::NodePlayer::NodePlayer ( std::unique_ptr< Node nodeToProcess,
PlayHeadState playHeadStateToUse = nullptr 
)

Creates an NodePlayer to process a Node.

Member Function Documentation

◆ getNode()

Node * graph::NodePlayer::getNode ( )

Returns the current Node.

◆ setNode() [1/2]

void graph::NodePlayer::setNode ( std::unique_ptr< Node newNode)

Sets the Node to process.

◆ setNode() [2/2]

void graph::NodePlayer::setNode ( std::unique_ptr< Node newNode,
double  sampleRateToUse,
int  blockSizeToUse 
)

Sets the Node to process with a new sample rate and block size.

◆ prepareToPlay() [1/2]

void graph::NodePlayer::prepareToPlay ( double  sampleRateToUse,
int  blockSizeToUse 
)

Prepares the current Node to be played.

◆ prepareToPlay() [2/2]

std::unique_ptr< NodeGraph > graph::NodePlayer::prepareToPlay ( std::unique_ptr< Node node,
NodeGraph oldGraph,
double  sampleRateToUse,
int  blockSizeToUse 
)

Prepares a specific Node to be played and returns all the Nodes.

References graph::timeToSample().

◆ process()

int graph::NodePlayer::process ( const Node::ProcessContext pc)

Processes a block of audio and MIDI data.

Returns the number of times a node was checked but unable to be processed.

◆ getSampleRate()

double graph::NodePlayer::getSampleRate ( ) const

◆ processPostorderedNodes()

int graph::NodePlayer::processPostorderedNodes ( NodeGraph graphToProcess,
const Node::ProcessContext pc 
)

◆ processWithPlayHeadState()

int graph::NodePlayer::processWithPlayHeadState ( PlayHeadState phs,
NodeGraph graphToProcess,
const Node::ProcessContext pc 
)
protected

◆ processPostorderedNodesSingleThreaded()

static int graph::NodePlayer::processPostorderedNodesSingleThreaded ( NodeGraph nodeGraph,
const Node::ProcessContext pc 
)
staticprotected

Processes a group of Nodes assuming a postordering VertexOrdering.

If these conditions are met the Nodes should be processed in a single loop iteration.

References graph::Node::AudioAndMidiBuffer::audio, graph::Node::ProcessContext::buffers, graph::Node::AudioAndMidiBuffer::midi, graph::Node::ProcessContext::numSamples, graph::NodeGraph::orderedNodes, graph::Node::ProcessContext::referenceSampleRange, and graph::NodeGraph::rootNode.

Member Data Documentation

◆ input

std::unique_ptr<Node> graph::NodePlayer::input
protected

◆ nodeGraph

std::unique_ptr<NodeGraph> graph::NodePlayer::nodeGraph
protected

◆ playHeadState

PlayHeadState* graph::NodePlayer::playHeadState = nullptr
protected

◆ sampleRate

double graph::NodePlayer::sampleRate = 0.0
protected

◆ blockSize

int graph::NodePlayer::blockSize = 0
protected

◆ inputAndNodesLock

juce::SpinLock graph::NodePlayer::inputAndNodesLock
protected

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