TracktionEngine
|
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. | |
Node * | getNode () |
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< NodeGraph > | prepareToPlay (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< Node > | input |
std::unique_ptr< NodeGraph > | nodeGraph |
PlayHeadState * | playHeadState = nullptr |
double | sampleRate = 0.0 |
int | blockSize = 0 |
juce::SpinLock | inputAndNodesLock |
Simple player for an Node.
This simply iterate all the nodes attempting to process them in a single thread.
|
default |
Creates an empty NodePlayer.
tracktion::graph::NodePlayer::NodePlayer | ( | std::unique_ptr< Node > | nodeToProcess, |
PlayHeadState * | playHeadStateToUse = nullptr |
||
) |
Creates an NodePlayer to process a Node.
Node * tracktion::graph::NodePlayer::getNode | ( | ) |
void tracktion::graph::NodePlayer::setNode | ( | std::unique_ptr< Node > | newNode | ) |
void tracktion::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.
References inputAndNodesLock, nodeGraph, and prepareToPlay().
void tracktion::graph::NodePlayer::prepareToPlay | ( | double | sampleRateToUse, |
int | blockSizeToUse | ||
) |
Prepares the current Node to be played.
References blockSize, input, nodeGraph, prepareToPlay(), and sampleRate.
Referenced by prepareToPlay(), and setNode().
std::unique_ptr< NodeGraph > tracktion::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 blockSize, tracktion::graph::PlayHeadState::playHead, playHeadState, sampleRate, tracktion::graph::PlayHead::setScrubbingBlockLength(), and tracktion::graph::timeToSample().
int tracktion::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.
References inputAndNodesLock, nodeGraph, playHeadState, processPostorderedNodes(), and processWithPlayHeadState().
double tracktion::graph::NodePlayer::getSampleRate | ( | ) | const |
References sampleRate.
int tracktion::graph::NodePlayer::processPostorderedNodes | ( | NodeGraph & | graphToProcess, |
const Node::ProcessContext & | pc | ||
) |
References processPostorderedNodesSingleThreaded().
Referenced by process(), and processWithPlayHeadState().
|
protected |
References tracktion::graph::Node::AudioAndMidiBuffer::audio, tracktion::graph::Node::ProcessContext::buffers, tracktion::graph::Node::AudioAndMidiBuffer::midi, tracktion::graph::Node::ProcessContext::numSamples, tracktion::graph::PlayHeadState::playHead, processPostorderedNodes(), tracktion::graph::Node::ProcessContext::referenceSampleRange, and tracktion::graph::PlayHeadState::update().
Referenced by process().
|
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 tracktion::graph::Node::AudioAndMidiBuffer::audio, tracktion::graph::Node::ProcessContext::buffers, tracktion::graph::Node::AudioAndMidiBuffer::midi, nodeGraph, tracktion::graph::Node::ProcessContext::numSamples, and tracktion::graph::Node::ProcessContext::referenceSampleRange.
Referenced by processPostorderedNodes().
|
protected |
Referenced by getNode(), and prepareToPlay().
|
protected |
Referenced by getNode(), prepareToPlay(), process(), processPostorderedNodesSingleThreaded(), and setNode().
|
protected |
Referenced by prepareToPlay(), and process().
|
protected |
Referenced by getSampleRate(), prepareToPlay(), prepareToPlay(), and setNode().
|
protected |
Referenced by prepareToPlay(), prepareToPlay(), and setNode().
|
protected |