#include <audio/core/audiopin.h>
Public Member Functions | |
MultiInputPin (Node *node, unsigned int reservedInputCount=2) | |
virtual | ~MultiInputPin () override |
void | pull (std::vector< SampleBuffer * > &result) |
void | reserveInputs (unsigned int inputCount) |
![]() | |
InputPinBase (Node *node) | |
virtual | ~InputPinBase () |
void | connect (OutputPin &input) |
void | disconnect (OutputPin &input) |
void | disconnectAll () |
Node & | getNode () |
An input pin is used by audio node to connect to other nodes. This pin can be connected to an arbitrary number of output pins belonging to different nodes. This is useful for example to build a mixing node that mixes any amount of input signals.
MultiInputPin | ( | Node * | node, |
unsigned int | reservedInputCount = 2 |
||
) |
|
overridevirtual |
void pull | ( | std::vector< SampleBuffer * > & | result | ) |
This method can be used by the node to pull a buffer of samples for every connected output pin. A result verctor has to be passed as an argument. The vector will be resized and filled with a SampleBuffer* for each connected pin. The contents of the vector can be nullptr when somewhere down the conected graph an output returns nullptr. It is advised to allocate the result vector in the constructor of the Node class that contains the MultiInpuPin, and to prea llocate memory using vector<>::reserve(), in order to avoid allocations on the audio thread.
result | vector that will be filled with pointers to a buffer for each connection. |
void reserveInputs | ( | unsigned int | inputCount | ) |
Allocates memory to be able to handle the specified number of inputs without having to perform allocations on the audio thread.
inputCount | the maximum number of inputs that will be connected to this pin. |