Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator > Class Template Reference

Fixed-capacity signed audio routing matrix with sample-continuous gain ramps. More...

#include <audio_matrix_mixer.hpp>

Public Member Functions

 AudioMatrixMixerT (const Allocator &allocator=Allocator{})
bool prepare (std::size_t max_block_size)
bool set_dimensions (std::size_t inputs, std::size_t outputs) noexcept
void set_headroom_policy (MatrixHeadroomPolicy policy) noexcept
 Headroom policy is structural, not automatable: change it while stopped or accept a block-boundary level change.
MatrixHeadroomPolicy headroom_policy () const noexcept
bool set_gain (std::size_t output, std::size_t input, SampleType gain) noexcept
bool set_gain_ramped (std::size_t output, std::size_t input, SampleType gain, std::size_t ramp_samples) noexcept
 The old value is used for the first sample.
SampleType gain (std::size_t output, std::size_t input) const noexcept
SampleType target_gain (std::size_t output, std::size_t input) const noexcept
std::size_t input_count () const noexcept
std::size_t output_count () const noexcept
std::size_t max_block_size () const noexcept
std::size_t nonfinite_gain_count () const noexcept
std::size_t out_of_range_gain_count () const noexcept
void reset () noexcept
 Clears scratch and settles active ramps at their targets.
bool process (const SampleType *const *inputs, std::size_t input_count, SampleType *const *outputs, std::size_t output_count, std::size_t frames) noexcept

Static Public Attributes

static constexpr std::size_t max_inputs = MaxInputs
static constexpr std::size_t max_outputs = MaxOutputs
static constexpr SampleType max_abs_gain = SampleType{64}

Detailed Description

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
requires detail::valid_audio_matrix_capacity<MaxInputs, MaxOutputs>
class pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >

Fixed-capacity signed audio routing matrix with sample-continuous gain ramps.

prepare() is control-thread-only and owns the sole allocation. All setters, reset(), and process() are allocation-free afterward. Gain automation is deterministic across block partitions. Non-finite gains become zero and are counted; non-finite audio follows normal IEEE propagation.

Input/output aliasing, including partial overlap, is supported because every input block is copied to prepared scratch before any output is written. Output buffers themselves must not overlap each other.

Constructor & Destructor Documentation

◆ AudioMatrixMixerT()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::AudioMatrixMixerT ( const Allocator & allocator = Allocator{})
inlineexplicit

Member Function Documentation

◆ gain()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
SampleType pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::gain ( std::size_t output,
std::size_t input ) const
inlinenoexcept

◆ headroom_policy()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
MatrixHeadroomPolicy pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::headroom_policy ( ) const
inlinenoexcept

◆ input_count()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::input_count ( ) const
inlinenoexcept

◆ max_block_size()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::max_block_size ( ) const
inlinenoexcept

◆ nonfinite_gain_count()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::nonfinite_gain_count ( ) const
inlinenoexcept

◆ out_of_range_gain_count()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::out_of_range_gain_count ( ) const
inlinenoexcept

◆ output_count()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::output_count ( ) const
inlinenoexcept

◆ prepare()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
bool pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::prepare ( std::size_t max_block_size)
inline

◆ process()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
bool pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::process ( const SampleType *const * inputs,
std::size_t input_count,
SampleType *const * outputs,
std::size_t output_count,
std::size_t frames )
inlinenoexcept

◆ reset()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
void pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::reset ( )
inlinenoexcept

Clears scratch and settles active ramps at their targets.

Matrix shape, gains, policy, and the non-finite diagnostic count are preserved.

◆ set_dimensions()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
bool pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::set_dimensions ( std::size_t inputs,
std::size_t outputs )
inlinenoexcept

◆ set_gain()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
bool pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::set_gain ( std::size_t output,
std::size_t input,
SampleType gain )
inlinenoexcept

◆ set_gain_ramped()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
bool pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::set_gain_ramped ( std::size_t output,
std::size_t input,
SampleType gain,
std::size_t ramp_samples )
inlinenoexcept

The old value is used for the first sample.

After ramp_samples frames the internal state equals the target, which is emitted on the following frame. Retargeting starts from the gain that would be used for the next sample, so no discontinuity is introduced.

◆ set_headroom_policy()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
void pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::set_headroom_policy ( MatrixHeadroomPolicy policy)
inlinenoexcept

Headroom policy is structural, not automatable: change it while stopped or accept a block-boundary level change.

◆ target_gain()

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
SampleType pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::target_gain ( std::size_t output,
std::size_t input ) const
inlinenoexcept

Member Data Documentation

◆ max_abs_gain

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
SampleType pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::max_abs_gain = SampleType{64}
staticconstexpr

◆ max_inputs

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::max_inputs = MaxInputs
staticconstexpr

◆ max_outputs

template<typename SampleType = float, std::size_t MaxInputs = 16, std::size_t MaxOutputs = 16, typename Allocator = std::allocator<SampleType>>
std::size_t pulp::signal::AudioMatrixMixerT< SampleType, MaxInputs, MaxOutputs, Allocator >::max_outputs = MaxOutputs
staticconstexpr

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