Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::AutoDuckedSendT< SampleType > Class Template Reference

Stereo send-gain processor for keeping an effect return out of the way of a source or sidechain signal. More...

#include <auto_ducked_send.hpp>

Classes

struct  Config

Public Types

using DetectorMode = typename EnvelopeFollowerT<SampleType>::Mode

Public Member Functions

AutoDuckedSendStatus prepare (SampleType sample_rate) noexcept
AutoDuckedSendStatus configure (const Config &next) noexcept
 Atomically adopts a complete valid configuration.
std::array< SampleType, 2 > process (SampleType send_left, SampleType send_right, SampleType detector_left, SampleType detector_right) noexcept
 Process a stereo send and an independent stereo detector sample.
void process_block (const SampleType *send_left, const SampleType *send_right, const SampleType *detector_left, const SampleType *detector_right, SampleType *output_left, SampleType *output_right, int num_samples) noexcept
 Out-of-place or in-place block processing.
void process_block (SampleType *send_left, SampleType *send_right, const SampleType *detector_left, const SampleType *detector_right, int num_samples) noexcept
 Convenience in-place block path for the send buffers.
void set_bypassed (bool bypassed) noexcept
bool bypassed () const noexcept
void reset () noexcept
const Config & config () const noexcept
bool prepared () const noexcept
SampleType sample_rate () const noexcept
std::array< SampleType, 2 > detector_envelope () const noexcept
std::array< SampleType, 2 > current_gain_db () const noexcept
std::array< GainReduction, 2 > gain_reduction () const noexcept

Static Public Member Functions

static SampleType gain_computer_db (SampleType detector_level_db, const Config &config) noexcept
 Pure memoryless detector-level-to-send-gain transfer function.
static constexpr int latency_samples () noexcept
static constexpr int tail_samples () noexcept

Static Public Attributes

static constexpr SampleType kMinThresholdDb = SampleType{-160}
static constexpr SampleType kMaxThresholdDb = SampleType{24}
static constexpr SampleType kMaxRangeDb = SampleType{96}
static constexpr SampleType kMinSendGainDb = SampleType{-160}
static constexpr SampleType kMaxSendGainDb = SampleType{24}
static constexpr SampleType kMaxSampleRate = SampleType{1536000}

Detailed Description

template<typename SampleType = float>
class pulp::signal::AutoDuckedSendT< SampleType >

Stereo send-gain processor for keeping an effect return out of the way of a source or sidechain signal.

The detector envelope is converted to a 1:1 attenuation above threshold, capped by range_db. send_gain_db is then applied independently of that attenuation. This object processes the wet/send input only: it neither accepts nor mixes a dry signal, and it owns no delay, effect, or routing policy. A caller mixes the returned send with dry audio elsewhere.

prepare() and configure() belong at a control-thread retiming point. Once prepared, scalar/block processing, bypass, reset, and inspection are bounded, lock-free, allocation-free, and exception-free. Bypass and the neutral gain setting return every finite send sample bit-exactly while the detector continues to advance.

Member Typedef Documentation

◆ DetectorMode

template<typename SampleType = float>
using pulp::signal::AutoDuckedSendT< SampleType >::DetectorMode = typename EnvelopeFollowerT<SampleType>::Mode

Member Function Documentation

◆ bypassed()

template<typename SampleType = float>
bool pulp::signal::AutoDuckedSendT< SampleType >::bypassed ( ) const
inlinenodiscardnoexcept

◆ config()

template<typename SampleType = float>
const Config & pulp::signal::AutoDuckedSendT< SampleType >::config ( ) const
inlinenodiscardnoexcept

◆ configure()

template<typename SampleType = float>
AutoDuckedSendStatus pulp::signal::AutoDuckedSendT< SampleType >::configure ( const Config & next)
inlinenodiscardnoexcept

Atomically adopts a complete valid configuration.

Rejection preserves both the previous configuration and all detector history.

◆ current_gain_db()

template<typename SampleType = float>
std::array< SampleType, 2 > pulp::signal::AutoDuckedSendT< SampleType >::current_gain_db ( ) const
inlinenodiscardnoexcept

◆ detector_envelope()

template<typename SampleType = float>
std::array< SampleType, 2 > pulp::signal::AutoDuckedSendT< SampleType >::detector_envelope ( ) const
inlinenodiscardnoexcept

◆ gain_computer_db()

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::gain_computer_db ( SampleType detector_level_db,
const Config & config )
inlinestaticnodiscardnoexcept

Pure memoryless detector-level-to-send-gain transfer function.

◆ gain_reduction()

template<typename SampleType = float>
std::array< GainReduction, 2 > pulp::signal::AutoDuckedSendT< SampleType >::gain_reduction ( ) const
inlinenodiscardnoexcept

◆ latency_samples()

template<typename SampleType = float>
constexpr int pulp::signal::AutoDuckedSendT< SampleType >::latency_samples ( )
inlinestaticnodiscardconstexprnoexcept

◆ prepare()

template<typename SampleType = float>
AutoDuckedSendStatus pulp::signal::AutoDuckedSendT< SampleType >::prepare ( SampleType sample_rate)
inlinenodiscardnoexcept

◆ prepared()

template<typename SampleType = float>
bool pulp::signal::AutoDuckedSendT< SampleType >::prepared ( ) const
inlinenodiscardnoexcept

◆ process()

template<typename SampleType = float>
std::array< SampleType, 2 > pulp::signal::AutoDuckedSendT< SampleType >::process ( SampleType send_left,
SampleType send_right,
SampleType detector_left,
SampleType detector_right )
inlinenodiscardnoexcept

Process a stereo send and an independent stereo detector sample.

Linked mode derives one control value from max(abs(L), abs(R)); detector polarity therefore cannot cancel. Independent mode controls each send channel from the corresponding detector channel.

◆ process_block() [1/2]

template<typename SampleType = float>
void pulp::signal::AutoDuckedSendT< SampleType >::process_block ( const SampleType * send_left,
const SampleType * send_right,
const SampleType * detector_left,
const SampleType * detector_right,
SampleType * output_left,
SampleType * output_right,
int num_samples )
inlinenoexcept

Out-of-place or in-place block processing.

The output may alias the matching send input. Detector buffers must not alias either output.

◆ process_block() [2/2]

template<typename SampleType = float>
void pulp::signal::AutoDuckedSendT< SampleType >::process_block ( SampleType * send_left,
SampleType * send_right,
const SampleType * detector_left,
const SampleType * detector_right,
int num_samples )
inlinenoexcept

Convenience in-place block path for the send buffers.

◆ reset()

template<typename SampleType = float>
void pulp::signal::AutoDuckedSendT< SampleType >::reset ( )
inlinenoexcept

◆ sample_rate()

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::sample_rate ( ) const
inlinenodiscardnoexcept

◆ set_bypassed()

template<typename SampleType = float>
void pulp::signal::AutoDuckedSendT< SampleType >::set_bypassed ( bool bypassed)
inlinenoexcept

◆ tail_samples()

template<typename SampleType = float>
constexpr int pulp::signal::AutoDuckedSendT< SampleType >::tail_samples ( )
inlinestaticnodiscardconstexprnoexcept

Member Data Documentation

◆ kMaxRangeDb

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMaxRangeDb = SampleType{96}
staticconstexpr

◆ kMaxSampleRate

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMaxSampleRate = SampleType{1536000}
staticconstexpr

◆ kMaxSendGainDb

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMaxSendGainDb = SampleType{24}
staticconstexpr

◆ kMaxThresholdDb

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMaxThresholdDb = SampleType{24}
staticconstexpr

◆ kMinSendGainDb

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMinSendGainDb = SampleType{-160}
staticconstexpr

◆ kMinThresholdDb

template<typename SampleType = float>
SampleType pulp::signal::AutoDuckedSendT< SampleType >::kMinThresholdDb = SampleType{-160}
staticconstexpr

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