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 connect (OutputPin &input) override
 
void disconnect (OutputPin &input) override
 
void disconnectAll () override
 
bool isConnected () const override
 
void reserveInputs (unsigned int inputCount)
 
- Public Member Functions inherited from InputPinBase
 InputPinBase (Node *node)
 
virtual ~InputPinBase ()
 
void enqueueConnect (OutputPin &pin)
 
void enqueueDisconnect (OutputPin &pin)
 
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

◆ connect()

void connect ( OutputPin input)
overridevirtual

Connect another node's output to this pin.

Parameters
inputto be connected to this pin.

Implements InputPinBase.

◆ disconnect()

void disconnect ( OutputPin input)
overridevirtual

Disconnect another node's output from this pin, if it is connected to this pin.

Parameters
inputthe pin to be disconnected from this pin

Implements InputPinBase.

◆ disconnectAll()

void disconnectAll ( )
overridevirtual

Disconnects this input from all the connected pins.

Implements InputPinBase.

◆ isConnected()

bool isConnected ( ) const
overridevirtual
Returns
wether the input is connected to any outputs

Implements InputPinBase.

◆ 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.