NAP
Public Member Functions | List of all members
MultiInputPin Class Referencefinal

#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)
 
- Public Member Functions inherited from InputPinBase
 InputPinBase (Node *node)
 
virtual ~InputPinBase ()
 
void connect (OutputPin &input)
 
void disconnect (OutputPin &input)
 
void disconnectAll ()
 
NodegetNode ()
 

Description

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.

Inheritance diagram for MultiInputPin:
[legend]
Collaboration diagram for MultiInputPin:
[legend]

Constructor & Destructor Documentation

◆ MultiInputPin()

MultiInputPin ( Node node,
unsigned int  reservedInputCount = 2 
)

◆ ~MultiInputPin()

virtual ~MultiInputPin ( )
overridevirtual

Member Function Documentation

◆ pull()

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.

Parameters
resultvector that will be filled with pointers to a buffer for each connection.

◆ reserveInputs()

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.

Parameters
inputCountthe maximum number of inputs that will be connected to this pin.