DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::Compressor< T >::LookaheadRamp Struct Reference

The lookahead as a ramp (LookaheadShape::Ramp). More...

#include <Compressor.h>

Public Member Functions

void prepare (int maxLength)
 Allocates for a longest ramp.
 
void clear () noexcept
 
void setLength (int wanted) noexcept
 Moves the ramp's length to wanted, a sample at a time (the sums follow, each step in constant time).
 
T process (T gr) noexcept
 One gain change in dB in, the ramped one out.
 

Public Attributes

std::vector< T > deepVal
 
std::vector< T > boxA
 
std::vector< T > boxB
 The queue of the sliding window; the histories of the two averages.
 
std::vector< uint32_t > deepPos
 When each queued value came.
 
uint32_t t = 0
 Values taken so far (wraps).
 
int mask = 0
 
int head = 0
 
int count = 0
 
int length = 0
 
int lenA = 1
 
int lenB = 1
 
int zerosA = 0
 
int zerosB = 0
 
double sumA = 0.0
 
double sumB = 0.0
 

Detailed Description

template<FloatType T>
struct dspark::Compressor< T >::LookaheadRamp

The lookahead as a ramp (LookaheadShape::Ramp).

Each gain change is replaced by the deepest of the last length + 1 (an exact sliding window: a queue in falling order of depth), and that runs through two moving averages whose lengths add up to length + 2. A reduction that the gain computer asks for at one sample is so reached, exactly, length samples later, when that sample leaves the lookahead's delay, along an S-shaped ramp; and it stays for length samples after the last sample that asked for it. With no gain change for as long as the window the output is exactly 0 dB.

Definition at line 3583 of file Compressor.h.

Member Function Documentation

◆ clear()

template<FloatType T>
void dspark::Compressor< T >::LookaheadRamp::clear ( )
inlinenoexcept

Definition at line 3604 of file Compressor.h.

◆ prepare()

template<FloatType T>
void dspark::Compressor< T >::LookaheadRamp::prepare ( int  maxLength)
inline

Allocates for a longest ramp.

Definition at line 3592 of file Compressor.h.

◆ process()

template<FloatType T>
T dspark::Compressor< T >::LookaheadRamp::process ( T  gr)
inlinenoexcept

One gain change in dB in, the ramped one out.

Definition at line 3636 of file Compressor.h.

◆ setLength()

template<FloatType T>
void dspark::Compressor< T >::LookaheadRamp::setLength ( int  wanted)
inlinenoexcept

Moves the ramp's length to wanted, a sample at a time (the sums follow, each step in constant time).

Definition at line 3616 of file Compressor.h.

Member Data Documentation

◆ boxA

template<FloatType T>
std::vector<T> dspark::Compressor< T >::LookaheadRamp::boxA

Definition at line 3585 of file Compressor.h.

◆ boxB

template<FloatType T>
std::vector<T> dspark::Compressor< T >::LookaheadRamp::boxB

The queue of the sliding window; the histories of the two averages.

Definition at line 3585 of file Compressor.h.

◆ count

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::count = 0

Definition at line 3588 of file Compressor.h.

◆ deepPos

template<FloatType T>
std::vector<uint32_t> dspark::Compressor< T >::LookaheadRamp::deepPos

When each queued value came.

Definition at line 3586 of file Compressor.h.

◆ deepVal

template<FloatType T>
std::vector<T> dspark::Compressor< T >::LookaheadRamp::deepVal

Definition at line 3585 of file Compressor.h.

◆ head

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::head = 0

Definition at line 3588 of file Compressor.h.

◆ lenA

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::lenA = 1

Definition at line 3588 of file Compressor.h.

◆ lenB

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::lenB = 1

Definition at line 3588 of file Compressor.h.

◆ length

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::length = 0

Definition at line 3588 of file Compressor.h.

◆ mask

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::mask = 0

Definition at line 3588 of file Compressor.h.

◆ sumA

template<FloatType T>
double dspark::Compressor< T >::LookaheadRamp::sumA = 0.0

Definition at line 3589 of file Compressor.h.

◆ sumB

template<FloatType T>
double dspark::Compressor< T >::LookaheadRamp::sumB = 0.0

Definition at line 3589 of file Compressor.h.

◆ t

template<FloatType T>
uint32_t dspark::Compressor< T >::LookaheadRamp::t = 0

Values taken so far (wraps).

Definition at line 3587 of file Compressor.h.

◆ zerosA

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::zerosA = 0

Definition at line 3588 of file Compressor.h.

◆ zerosB

template<FloatType T>
int dspark::Compressor< T >::LookaheadRamp::zerosB = 0

Definition at line 3588 of file Compressor.h.


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