VISR  0.11.6
Versatile Interactive Scene Renderer
visr::rcl::DelayMatrix Class Reference

#include <delay_matrix.hpp>

Inheritance diagram for visr::rcl::DelayMatrix:
visr::AtomicComponent visr::Component

Public Types

enum  ControlPortConfig { ControlPortConfig::None = 0, ControlPortConfig::Delay = 1<<0, ControlPortConfig::Gain = 1<<1, ControlPortConfig::All = Delay | Gain }
 
using MethodDelayPolicy = rbbl::MultichannelDelayLine< SampleType >::MethodDelayPolicy
 

Public Member Functions

 DelayMatrix (SignalFlowContext const &context, char const *name, CompositeComponent *parent=nullptr)
 
 DelayMatrix (SignalFlowContext const &context, char const *name, CompositeComponent *parent, std::size_t numberOfInputs, std::size_t numberOfOutputs, std::size_t interpolationSteps, SampleType maximumDelaySeconds, const char *interpolationMethod, MethodDelayPolicy methodDelayPolicy, ControlPortConfig controlInputs, SampleType initialDelaySeconds=static_cast< SampleType >(0.0), SampleType initialGainLinear=static_cast< SampleType >(1.0))
 
 DelayMatrix (SignalFlowContext const &context, char const *name, CompositeComponent *parent, std::size_t numberOfInputs, std::size_t numberOfOutputs, std::size_t interpolationSteps, SampleType maximumDelaySeconds, const char *interpolationMethod, MethodDelayPolicy methodDelayPolicy, ControlPortConfig controlInputs, efl::BasicMatrix< SampleType > const &initialDelaysSeconds, efl::BasicMatrix< SampleType > const &initialGainsLinear)
 
void setup (std::size_t numberOfInputs, std::size_t numberOfOutputs, std::size_t interpolationSteps, SampleType maximumDelaySeconds, const char *interpolationMethod, MethodDelayPolicy methodDelayPolicy, ControlPortConfig controlInputs, SampleType initialDelaySeconds=static_cast< SampleType >(0.0), SampleType initialGainLinear=static_cast< SampleType >(1.0))
 
void setup (std::size_t numberOfInputs, std::size_t numberOfOutputs, std::size_t interpolationSteps, SampleType maximumDelaySeconds, const char *interpolationMethod, MethodDelayPolicy methodDelayPolicy, ControlPortConfig controlInputs, efl::BasicMatrix< SampleType > const &initialDelaysSeconds, efl::BasicMatrix< SampleType > const &initialGainsLinear)
 
void process ()
 
void setDelayAndGain (efl::BasicMatrix< SampleType > const &newDelays, efl::BasicMatrix< SampleType > const &newGains)
 
void setDelay (efl::BasicMatrix< SampleType > const &newDelays)
 
void setGain (efl::BasicMatrix< SampleType > const &newGains)
 
- Public Member Functions inherited from visr::AtomicComponent
 AtomicComponent (SignalFlowContext const &context, char const *name, CompositeComponent *parent=nullptr)
 
 AtomicComponent (AtomicComponent const &)=delete
 
 AtomicComponent (AtomicComponent &&)=delete
 
virtual ~AtomicComponent () override
 
- Public Member Functions inherited from visr::Component
 Component (SignalFlowContext const &context, char const *componentName, CompositeComponent *parent)
 
 Component (SignalFlowContext const &context, std::string const &componentName, CompositeComponent *parent)
 
 Component (Component const &)=delete
 
 Component (Component &&)=delete
 
Componentoperator= (Component const &)=delete
 
Componentoperator= (Component &&)=delete
 
virtual ~Component ()
 
std::string const & name () const
 
std::string fullName () const
 
void status (StatusMessage::Kind status, char const *message)
 
template<typename ... MessageArgs>
void status (StatusMessage::Kind status, MessageArgs ... args)
 
bool isComposite () const
 
AudioPortBaseaudioPort (char const *portName)
 
AudioPortBase const & audioPort (char const *portName) const
 
AudioPortBaseaudioPort (std::string const &portName)
 
AudioPortBase const & audioPort (std::string const &portName) const
 
ParameterPortBaseparameterPort (char const *portName)
 
ParameterPortBase const & parameterPort (char const *portName) const
 
ParameterPortBaseparameterPort (std::string const &portName)
 
ParameterPortBase const & parameterPort (std::string const &portName) const
 
SamplingFrequencyType samplingFrequency () const
 
std::size_t period () const
 
bool isTopLevel () const
 
impl::ComponentImplementationimplementation ()
 
impl::ComponentImplementation const & implementation () const
 

Additional Inherited Members

- Static Public Member Functions inherited from visr::Component
static const std::string & nameSeparator ()
 
- Protected Member Functions inherited from visr::Component
 Component (impl::ComponentImplementation *impl)
 

Detailed Description

Audio Component for applying channel-specific delays and gains to a multichannel audio signal. The delays and gains can be changed at runtime. Optionally, the class features smooth transitions if gains and/or delays are changed. This class has one input port named "in" and one output port named "out". The widths of the input and the output port are identical and is set by the argument numberOfChannels in the setup() method.

Todo:

Implement flexible transition length (at the moment, the block length is always used

general cleanup (including more comprehensive range checks for the delay)

Member Typedef Documentation

◆ MethodDelayPolicy

Member Enumeration Documentation

◆ ControlPortConfig

Enumeration denoting which control inputs should be activated

Enumerator
None 
Delay 
Gain 
All 

Constructor & Destructor Documentation

◆ DelayMatrix() [1/3]

visr::rcl::DelayMatrix::DelayMatrix ( SignalFlowContext const &  context,
char const *  name,
CompositeComponent parent = nullptr 
)
explicit

Constructor, creates a basic, not fully initialised object. A setup() method must be called before the component before the process() method can be used.

Parameters
contextConfiguration object containing basic execution parameters.
nameThe name of the component. Must be unique within the containing composite component (if there is one).
parentPointer to a containing component if there is one. Specify nullptr in case of a top-level component.

◆ DelayMatrix() [2/3]

visr::rcl::DelayMatrix::DelayMatrix ( SignalFlowContext const &  context,
char const *  name,
CompositeComponent parent,
std::size_t  numberOfInputs,
std::size_t  numberOfOutputs,
std::size_t  interpolationSteps,
SampleType  maximumDelaySeconds,
const char *  interpolationMethod,
MethodDelayPolicy  methodDelayPolicy,
ControlPortConfig  controlInputs,
SampleType  initialDelaySeconds = static_cast<SampleType>(0.0),
SampleType  initialGainLinear = static_cast<SampleType>(1.0) 
)
explicit

Constructor, creates a fully initialised object. A setup() method does not need to called. This overload initalises all delay and gain values to the same (possibly defaulted) values.

Parameters
contextConfiguration object containing basic execution parameters.
nameThe name of the component. Must be unique within the containing composite component (if there is one).
parentPointer to a containing component if there is one. Specify nullptr in case of a top-level component.
numberOfInputsThe number of input audio waveforms
numberOfOutputsThe number of output audio waveforms
interpolationStepsThe number of samples needed for the transition after new delays and/or gains are set. It must be an integral multiple of the period of the signal flow. The value "0" denotes an immediate application of the new settings.
maximumDelaySecondsThe maximal delay value supported by this object (in seconds)
interpolationMethodThe interpolation method to be applied. The string must correspond to a algorithm registered in rbbl::FractionalDelayFactory
methodDelayPolicyEnumeration value governing how the method delay of the interpolation method is incorporated into the delay values applied to the signals.
controlInputsWhether the component should contain parameter inputs for the gain and delay parameter.
initialDelaySecondsThe initial delay value for all channels (in seconds, default: 0.0)
initialGainLinearThe initial delay value for all channels (in linear scale, default: 1.0)

◆ DelayMatrix() [3/3]

visr::rcl::DelayMatrix::DelayMatrix ( SignalFlowContext const &  context,
char const *  name,
CompositeComponent parent,
std::size_t  numberOfInputs,
std::size_t  numberOfOutputs,
std::size_t  interpolationSteps,
SampleType  maximumDelaySeconds,
const char *  interpolationMethod,
MethodDelayPolicy  methodDelayPolicy,
ControlPortConfig  controlInputs,
efl::BasicMatrix< SampleType > const &  initialDelaysSeconds,
efl::BasicMatrix< SampleType > const &  initialGainsLinear 
)
explicit

Constructor, creates a fully initialised object. A setup() method does not need to called. This overload accepts matrices of initial delays and gains to initialise each routing point individually.

Parameters
contextConfiguration object containing basic execution parameters.
nameThe name of the component. Must be unique within the containing composite component (if there is one).
parentPointer to a containing component if there is one. Specify nullptr in case of a top-level component.
numberOfInputsThe number of input audio waveforms
numberOfOutputsThe number of output audio waveforms
interpolationStepsThe number of samples needed for the transition after a new delay and/or gain is set. It must be an integral multiple of the period of the signal flow. The value "0" denotes an immediate application of the new delay/gain values.
maximumDelaySecondsThe maximal delay value supported by this object (in seconds)
interpolationMethodThe interpolation method to be applied. The string must correspond to a algorithm registered in rbbl::FractionalDelayFactory
methodDelayPolicyEnumeration value governing how the method delay of the interpolation method is incorporated into the delay values applied to the signals.
controlInputsWhether the component should contain parameter inputs for the gain and delay parameter.
initialDelaysSecondsThe delays for all channels in seconds. The number of elements of this vector must match the channel number of this object.
initialGainsLinearThe initial gain values for all channels, given in a linear scale. The the number of elements in this vector must match the channel number of this object.

Member Function Documentation

◆ process()

void visr::rcl::DelayMatrix::process ( )
virtual

The process method applies the (interpolated) delay and gain values to the stream of input samples.

Implements visr::AtomicComponent.

◆ setDelay()

void visr::rcl::DelayMatrix::setDelay ( efl::BasicMatrix< SampleType > const &  newDelays)

Set new values for the delays. This is a simplified version of setGainAndDelay(), which leaves the gain values unaltered. The semantics of the transition are documented in setDelayAndGain(), except that the previous 'new gain value' remains unaltered als the new 'new gain value'.

See also
setDelayAndGain
Parameters
newDelaysA vector containing the new delay values for all channels (in linear scale). The vector must have numberOfChannels elements.
Exceptions
std::invalid_argumentIf a vector size is invalid
std::invalid_argumentIf a delay value exceeds the maximum delay setting.

◆ setDelayAndGain()

void visr::rcl::DelayMatrix::setDelayAndGain ( efl::BasicMatrix< SampleType > const &  newDelays,
efl::BasicMatrix< SampleType > const &  newGains 
)

Set new values for the delays and the gains. This method triggers a new fading process for a smooth transition between the current and the new gain and delay values. The semantics of the smooth transition are as follows:

  • If the component is currently not in a transition process (i.e., at least interpolationSteps samples after the previous parameter change), a new transition process is started.
  • If component is currently within a transition process, a new transition is started, and the current interpolated values for the gains and the delays are used as the start value of this new transistion, which performs a transition to the new gains and delays over an interval of interpolationSteps samples.
Parameters
newDelaysA containing the new delay values for all channels (in seconds). The matrix must have 1 row and numberOfChannels columns.
newGainsA matrix containing the new gain values for all channels (in linear scale). The matrix must have 1 row and numberOfChannels columns.
Exceptions
std::invalid_argumentIf a matrix size is invalid
std::invalid_argumentIf a delay value exceeds the maximum delay setting.

◆ setGain()

void visr::rcl::DelayMatrix::setGain ( efl::BasicMatrix< SampleType > const &  newGains)

Set new values for the gains. This is a simplified version of setGainAndDelay(), which leaves the delay values unaltered. The semantics of the transition are documented in setDelayAndGain(), except that the previous 'new delay value' remains unaltered als the new 'new delay value'.

See also
setDelayAndGain
Parameters
newGainsA vector containing the new gain values for all channels (in linear scale). The vector must have numberOfChannels elements.
Exceptions
std::invalid_argumentIf a vector size is invalid
std::invalid_argumentIf a delay value exceeds the maximum delay setting.

◆ setup() [1/2]

void visr::rcl::DelayMatrix::setup ( std::size_t  numberOfInputs,
std::size_t  numberOfOutputs,
std::size_t  interpolationSteps,
SampleType  maximumDelaySeconds,
const char *  interpolationMethod,
MethodDelayPolicy  methodDelayPolicy,
ControlPortConfig  controlInputs,
SampleType  initialDelaySeconds = static_cast<SampleType>(0.0),
SampleType  initialGainLinear = static_cast<SampleType>(1.0) 
)

Setup method to initialise the object and set the parameters.

Parameters
numberOfInputsThe number of input audio waveforms
numberOfOutputsThe number of output audio waveforms
interpolationStepsThe number of samples needed for the transition after new delays and/or gains are set. It must be an integral multiple of the period of the signal flow. The value "0" denotes an immediate application of the new settings.
maximumDelaySecondsThe maximal delay value supported by this object (in seconds)
interpolationMethodThe interpolation method to be applied. The string must correspond to a algorithm registered in rbbl::FractionalDelayFactory
methodDelayPolicyEnumeration value governing how the method delay of the interpolation method is incorporated into the delay values applied to the signals.
controlInputsWhether the component should contain parameter inputs for the gain and delay parameter.
initialDelaySecondsThe initial delay value for all channels (in seconds, default: 0.0)
initialGainLinearThe initial delay value for all channels (in linear scale, default: 1.0)

◆ setup() [2/2]

void visr::rcl::DelayMatrix::setup ( std::size_t  numberOfInputs,
std::size_t  numberOfOutputs,
std::size_t  interpolationSteps,
SampleType  maximumDelaySeconds,
const char *  interpolationMethod,
MethodDelayPolicy  methodDelayPolicy,
ControlPortConfig  controlInputs,
efl::BasicMatrix< SampleType > const &  initialDelaysSeconds,
efl::BasicMatrix< SampleType > const &  initialGainsLinear 
)

Setup method to initialise the object and set the parameters.

Parameters
numberOfInputsThe number of input audio waveforms
numberOfOutputsThe number of output audio waveforms
interpolationStepsThe number of samples needed for the transition after a new delay and/or gain is set. It must be an integral multiple of the period of the signal flow. The value "0" denotes an immediate application of the new delay/gain values.
maximumDelaySecondsThe maximal delay value supported by this object (in seconds)
interpolationMethodThe interpolation method to be applied. The string must correspond to a algorithm registered in rbbl::FractionalDelayFactory
methodDelayPolicyEnumeration value governing how the method delay of the interpolation method is incorporated into the delay values applied to the signals.
controlInputsWhether the component should contain parameter inputs for the gain and delay parameter.
initialDelaysSecondsThe delays for all channels in seconds. The number of elements of this vector must match the channel number of this object.
initialGainsLinearThe initial gain values for all channels, given in a linear scale. The the number of elements in this vector must match the channel number of this object.

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