![]() |
VISR
0.11.1
Versatile Interactive Scene Renderer
|
#include <audio_signal_flow.hpp>
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::Output & | externalParameterReceivePort (char const *portName) |
CommunicationProtocolBase::Input & | externalParameterSendPort (char const *portName) |
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).
using visr::rrl::AudioSignalFlow::ProtocolReceiveEndpoints = std::map<std::string, std::unique_ptr<CommunicationProtocolBase::Output> > |
Query and access external parameter ports.
using visr::rrl::AudioSignalFlow::ProtocolSendEndpoints = std::map<std::string, std::unique_ptr<CommunicationProtocolBase::Input> > |
using visr::rrl::AudioSignalFlow::SignalIndexType = std::size_t |
|
explicit |
Constructor.
flow | The component (composite or atomic) containing the processing functionality. |
visr::rrl::AudioSignalFlow::~AudioSignalFlow | ( | ) |
Destructor.
char const * visr::rrl::AudioSignalFlow::audioCapturePortName | ( | std::size_t | idx | ) | const |
Return the name of the capture port indexed by idx
std::out_of_range | If the idx exceeds the number of capture ports. |
char const * visr::rrl::AudioSignalFlow::audioPlaybackPortName | ( | std::size_t | idx | ) | const |
Return the name of the playback port indexed by idx
std::out_of_range | If the idx exceeds the number of playback ports. |
|
inline |
CommunicationProtocolBase::Output & visr::rrl::AudioSignalFlow::externalParameterReceivePort | ( | char const * | portName | ) |
Return a input protocol for a named top-level parameter port.
std::out_of_range | No top-level parameter port with this name exists. |
|
inline |
CommunicationProtocolBase::Input & visr::rrl::AudioSignalFlow::externalParameterSendPort | ( | char const * | portName | ) |
Return a output protocol for a named top-level parameter port.
std::out_of_range | No top-level parameter port with this name exists. |
|
inline |
|
inline |
std::size_t visr::rrl::AudioSignalFlow::numberOfAudioCapturePorts | ( | ) | const |
std::size_t visr::rrl::AudioSignalFlow::numberOfAudioPlaybackPorts | ( | ) | const |
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.
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.
std::size_t visr::rrl::AudioSignalFlow::period | ( | ) | const |
Query methods. Return the number of samples processed in each process() function
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
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.
captureSamples | Pointer to the matrix of input samples. | |
[out] | playbackSamples | Pointer to the first element of the matrix of output samples filled by the process() call. |
captureChannelStride | Number of samples between consecutive audio channels of the input matrix. | |
captureSampleStride | Number of samples between consecutive audio channels of the input matrix. A value of 1 corresponds to consecutively stored samples. | |
playbackChannelStride | Number of samples between consecutive audio channels of the output matrix. | |
playbackSampleStride | Number of samples between consecutive audio channels of the output matrix. A value of 1 corresponds to consecutively stored samples. |
|
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.
userData | An opaque pointer, must hold the 'this' pointer of the AudioSignalFlow object |
captureSamples | A 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. |
playbackSamples | A 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. |
status | A enumeration type to hold the result of the process() function. Typically used to signal error conditions or to request termination. |