VISR  0.11.1
Versatile Interactive Scene Renderer
visr::rrl::AudioSignalFlow Class Reference

#include <audio_signal_flow.hpp>

Inheritance diagram for visr::rrl::AudioSignalFlow:
visr::mex::gain_matrix::SignalFlow visr::mex::gain_matrix::SignalFlow visr::mex::late_reverb_filter_calculator::SignalFlow

Public Types

using SignalIndexType = std::size_t
 

Public Member Functions

 AudioSignalFlow (Component &flow)
 
 ~AudioSignalFlow ()
 
bool process (SampleType const *const *captureSamples, SampleType *const *playbackSamples)
 
void process (SampleType const *captureSamples, std::size_t captureChannelStride, std::size_t captureSampleStride, SampleType *playbackSamples, std::size_t playbackChannelStride, std::size_t playbackSampleStride)
 
std::size_t period () const
 
std::size_t numberOfAudioCapturePorts () const
 
std::size_t numberOfAudioPlaybackPorts () const
 
char const * audioCapturePortName (std::size_t idx) const
 
char const * audioPlaybackPortName (std::size_t idx) const
 
std::size_t numberOfCaptureChannels () const
 
std::size_t numberOfPlaybackChannels () const
 

Static Public Member Functions

static void processFunction (void *userData, SampleType const *const *captureSamples, SampleType *const *playbackSamples, bool &status)
 
using ProtocolReceiveEndpoints = std::map< std::string, std::unique_ptr< CommunicationProtocolBase::Output > >
 
using ProtocolSendEndpoints = std::map< std::string, std::unique_ptr< CommunicationProtocolBase::Input > >
 
std::size_t numberExternalParameterReceivePorts () const
 
std::size_t numberExternalParameterSendPorts () const
 
ProtocolReceiveEndpoints const & externalParameterReceiveEndpoints () const
 
ProtocolSendEndpoints const & externalParameterSendEndpoints () const
 
CommunicationProtocolBase::OutputexternalParameterReceivePort (char const *portName)
 
CommunicationProtocolBase::InputexternalParameterSendPort (char const *portName)
 

Detailed Description

Base class for signal flows, i.e., graphs of connected audio components which perform an audio signal processing operation. This base class provides the infrastructure for setting up the graphs and for transferring the input and output samples. For the audio processing, this class provides a callback interface that must be called in regular intervals (i.e., for a fixed number of samples consumed and generated, respectively).

Member Typedef Documentation

◆ ProtocolReceiveEndpoints

Query and access external parameter ports.

◆ ProtocolSendEndpoints

◆ SignalIndexType

Constructor & Destructor Documentation

◆ AudioSignalFlow()

visr::rrl::AudioSignalFlow::AudioSignalFlow ( Component flow)
explicit

Constructor.

Parameters
flowThe component (composite or atomic) containing the processing functionality.

◆ ~AudioSignalFlow()

visr::rrl::AudioSignalFlow::~AudioSignalFlow ( )

Destructor.

Member Function Documentation

◆ audioCapturePortName()

char const * visr::rrl::AudioSignalFlow::audioCapturePortName ( std::size_t  idx) const

Return the name of the capture port indexed by idx

Exceptions
std::out_of_rangeIf the idx exceeds the number of capture ports.

◆ audioPlaybackPortName()

char const * visr::rrl::AudioSignalFlow::audioPlaybackPortName ( std::size_t  idx) const

Return the name of the playback port indexed by idx

Exceptions
std::out_of_rangeIf the idx exceeds the number of playback ports.

◆ externalParameterReceiveEndpoints()

ProtocolReceiveEndpoints const& visr::rrl::AudioSignalFlow::externalParameterReceiveEndpoints ( ) const
inline

◆ externalParameterReceivePort()

CommunicationProtocolBase::Output & visr::rrl::AudioSignalFlow::externalParameterReceivePort ( char const *  portName)

Return a input protocol for a named top-level parameter port.

Exceptions
std::out_of_rangeNo top-level parameter port with this name exists.

◆ externalParameterSendEndpoints()

ProtocolSendEndpoints const& visr::rrl::AudioSignalFlow::externalParameterSendEndpoints ( ) const
inline

◆ externalParameterSendPort()

CommunicationProtocolBase::Input & visr::rrl::AudioSignalFlow::externalParameterSendPort ( char const *  portName)

Return a output protocol for a named top-level parameter port.

Exceptions
std::out_of_rangeNo top-level parameter port with this name exists.

◆ numberExternalParameterReceivePorts()

std::size_t visr::rrl::AudioSignalFlow::numberExternalParameterReceivePorts ( ) const
inline

◆ numberExternalParameterSendPorts()

std::size_t visr::rrl::AudioSignalFlow::numberExternalParameterSendPorts ( ) const
inline

◆ numberOfAudioCapturePorts()

std::size_t visr::rrl::AudioSignalFlow::numberOfAudioCapturePorts ( ) const

◆ numberOfAudioPlaybackPorts()

std::size_t visr::rrl::AudioSignalFlow::numberOfAudioPlaybackPorts ( ) const

◆ numberOfCaptureChannels()

std::size_t visr::rrl::AudioSignalFlow::numberOfCaptureChannels ( ) const

Query the width of the capture port, i.e., the number of external inputs of the graph.

◆ numberOfPlaybackChannels()

std::size_t visr::rrl::AudioSignalFlow::numberOfPlaybackChannels ( ) const

Query the width of the playback port, i.e., the number of external outputs of the graph.

◆ period()

std::size_t visr::rrl::AudioSignalFlow::period ( ) const

Query methods. Return the number of samples processed in each process() function

Note
At the moment this is required by the Python binding.

◆ process() [1/2]

bool visr::rrl::AudioSignalFlow::process ( SampleType const *const *  captureSamples,
SampleType *const *  playbackSamples 
)

Method to transfer the capture and playback samples to and from the locations where they are expected, and execute the contained atomic components. Called from processFunction(). For a parameter description (except userData), see

See also
processFunction().

◆ process() [2/2]

void visr::rrl::AudioSignalFlow::process ( SampleType const *  captureSamples,
std::size_t  captureChannelStride,
std::size_t  captureSampleStride,
SampleType playbackSamples,
std::size_t  playbackChannelStride,
std::size_t  playbackSampleStride 
)

Alternative process() function assuming matrices with fixed channel and element strides for the inputs and outputs.

Parameters
captureSamplesPointer to the matrix of input samples.
[out]playbackSamplesPointer to the first element of the matrix of output samples filled by the process() call.
captureChannelStrideNumber of samples between consecutive audio channels of the input matrix.
captureSampleStrideNumber of samples between consecutive audio channels of the input matrix. A value of 1 corresponds to consecutively stored samples.
playbackChannelStrideNumber of samples between consecutive audio channels of the output matrix.
playbackSampleStrideNumber of samples between consecutive audio channels of the output matrix. A value of 1 corresponds to consecutively stored samples.
Todo:
Provide a callback function for interfacing with audio interfaces.

◆ processFunction()

void visr::rrl::AudioSignalFlow::processFunction ( void *  userData,
SampleType const *const *  captureSamples,
SampleType *const *  playbackSamples,
bool &  status 
)
static

A static, i.e., non-class function which can be registered as a callback method. Calling this method triggers the transfer of the passed samples and the invocation of the process() function of the derived subclasses. The method must only only be called after the initialisation of the class is complete.

Parameters
userDataAn opaque pointer, must hold the 'this' pointer of the AudioSignalFlow object
captureSamplesA pointer array to arrays of input samples to be processed. The pointer array must hold numberOfCaptureChannels() elements, and each sample array must hold period() samples.
playbackSamplesA pointer array to arrays of output samples to hold the results of the operation. The pointer array must hold numberOfPlaybackChannels() elements, and each sample array must hold period() samples.
statusA enumeration type to hold the result of the process() function. Typically used to signal error conditions or to request termination.
Todo:
After the redesign, the translation to a callback function (and discarding the object pointer) needs to be done somewhere else!

The documentation for this class was generated from the following files: