Manages a graph of AudioNode instances.
More...
#include <AudioGraph.hpp>
|
const uint | maxNumberOfChannels |
| Maximum number of channels that is supported by the audio graph.
|
|
const uint | maxNumberOfFrames |
| Maximum number of frames that is supported by the audio graph.
|
|
Manages a graph of AudioNode instances.
AudioGraph class.
This class can be used to easily put together complicated audio pipelines by adding and then connecting AudioNode instances together.
◆ AudioGraph()
switchboard::AudioGraph::AudioGraph |
( |
const uint | maxNumberOfChannels = constants::STEREO, |
|
|
const uint | maxNumberOfFrames = constants::MAX_NUMBER_OF_FRAMES ) |
Creates an AudioGraph.
- Parameters
-
maxNumberOfChannels | Maximum number of channels that is supported by the audio graph. |
maxNumberOfFrames | Maximum number of frames that is supported by the audio graph. |
◆ addNode()
bool switchboard::AudioGraph::addNode |
( |
AudioNode & | audioNode, |
|
|
bool | moveOwnership = false ) |
Adds a node to the audio graph.
- Parameters
-
audioNode | The node to be added. |
moveOwnership | If set to true, the AudioGraph will destruct the audio node. |
- Returns
- True if the node was successfully added, false otherwise.
◆ connect() [1/4]
Connects a processor node to another processor node.
- Parameters
-
srcNode | The source processor node. |
dstNode | The destination processor node. |
- Returns
- True if the nodes were successfully connected, false otherwise.
◆ connect() [2/4]
Connects a processor node to a sink node.
- Parameters
-
srcNode | The processor node. |
dstNode | The sink node. |
- Returns
- True if the nodes were successfully connected, false otherwise.
◆ connect() [3/4]
Connects a source node to a processor node.
- Parameters
-
srcNode | The source node. |
dstNode | The processor node. |
- Returns
- True if the nodes were successfully connected, false otherwise.
◆ connect() [4/4]
Connects a source node to a sink node.
- Parameters
-
srcNode | The source node. |
dstNode | The sink node. |
- Returns
- True if the nodes were successfully connected, false otherwise.
◆ getInputNode()
Returns the input node of the audio graph.
- Returns
- The input node.
◆ getNodeByName() [1/2]
AudioNode * switchboard::AudioGraph::getNodeByName |
( |
const char * | name | ) |
const |
Finds an audio node by name.
- Parameters
-
name | The name of the audio node. |
- Returns
- The found audio node, or nullptr if the audio node could not be found.
◆ getNodeByName() [2/2]
AudioNode * switchboard::AudioGraph::getNodeByName |
( |
const std::string & | name | ) |
const |
Finds an audio node by name.
- Parameters
-
name | The name of the audio node. |
- Returns
- The found audio node, or nullptr if the audio node could not be found.
◆ getNodes()
const std::vector< AudioNode * > & switchboard::AudioGraph::getNodes |
( |
| ) |
const |
Gets a list of all audio nodes in the audio graph.
- Returns
- A vector with all the audio nodes in the audio graph.
◆ getOutputNode()
Returns the output node of the audio graph.
- Returns
- The output node.
◆ isRunning()
bool switchboard::AudioGraph::isRunning |
( |
| ) |
|
Checks if the audio graph has been started.
- Returns
- True if the audio graph was already started successfully, false otherwise.
◆ process()
The real-time audio process function of the audio graph.
Processes the audio in the provided input audio buses and puts the output audio in the provided output audio buses.
- Parameters
-
inAudioBuses | The input audio buses. |
outAudioBuses | The output audio buses. |
- Returns
- True if the process call was successful, false otherwise.
◆ processBuffer()
bool switchboard::AudioGraph::processBuffer |
( |
AudioBuffer< float > * | inAudioBuffer, |
|
|
AudioBuffer< float > * | outAudioBuffer ) |
The real-time audio process function of the audio graph that processes audio buffers.
Processes the audio in the provided input audio buffer and puts the output audio in the provided output audio buffer. This is a convenience method that can be used when the audio graph has no more than one input and output buses. To process multiple buses, use the process
method.
- Parameters
-
inAudioBuffer | The input audio buffer, or null if there graph has no input. |
outAudioBuffer | The output audio buffer, or null if the graph has no output. |
- Returns
- True if the process call was successful, false otherwise.
◆ removeNode()
bool switchboard::AudioGraph::removeNode |
( |
AudioNode & | audioNode | ) |
|
Removes a node from the audio graph.
- Parameters
-
audioNode | The node to be removed. |
- Returns
- True if the node was successfully removed, false otherwise.
◆ start()
WASM bool switchboard::AudioGraph::start |
( |
| ) |
|
Starts the audio graph.
- Returns
- True if the audio graph was started successfully, false otherwise.