DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::StereoWidth< T > Class Template Reference

High-performance stereo image processor with phase-aligned bass mono. More...

#include <StereoWidth.h>

Public Member Functions

 StereoWidth ()=default
 
 ~StereoWidth ()=default
 
void prepare (double sampleRate) noexcept
 Prepares the processor and resets internal states.
 
void prepare (const AudioSpec &spec) noexcept
 Prepares from AudioSpec (unified API).
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes an AudioBufferView in-place.
 
void setWidth (T width) noexcept
 Sets the overall stereo width factor.
 
getWidth () const noexcept
 Returns current width setting.
 
void setBassMono (bool enabled, double cutoffHz=100.0) noexcept
 Toggles Bass Mono and updates the crossover frequency.
 
void process (T *left, T *right, int numSamples) noexcept
 Process a full block of audio. Optimized for SIMD vectorization.
 
void reset () noexcept
 Clears the internal filter states to prevent artifact ringing.
 
std::vector< uint8_t > getState () const
 Serializes the parameter state (setup/UI threads; allocates).
 
bool setState (const uint8_t *data, size_t size)
 Restores parameters from a blob (tolerant; rejects foreign ids).
 

Protected Member Functions

void updateBassMonoCoeff (double cutoff) noexcept
 

Detailed Description

template<FloatType T>
class dspark::StereoWidth< T >

High-performance stereo image processor with phase-aligned bass mono.

Template Parameters
TSample type (float or double).

Definition at line 48 of file StereoWidth.h.

Constructor & Destructor Documentation

◆ StereoWidth()

template<FloatType T>
dspark::StereoWidth< T >::StereoWidth ( )
default

◆ ~StereoWidth()

template<FloatType T>
dspark::StereoWidth< T >::~StereoWidth ( )
default

Member Function Documentation

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::StereoWidth< T >::getState ( ) const
inline

Serializes the parameter state (setup/UI threads; allocates).

Definition at line 174 of file StereoWidth.h.

◆ getWidth()

template<FloatType T>
T dspark::StereoWidth< T >::getWidth ( ) const
inlinenoexcept

Returns current width setting.

Definition at line 92 of file StereoWidth.h.

◆ prepare() [1/2]

template<FloatType T>
void dspark::StereoWidth< T >::prepare ( const AudioSpec spec)
inlinenoexcept

Prepares from AudioSpec (unified API).

Definition at line 67 of file StereoWidth.h.

◆ prepare() [2/2]

template<FloatType T>
void dspark::StereoWidth< T >::prepare ( double  sampleRate)
inlinenoexcept

Prepares the processor and resets internal states.

Parameters
sampleRateSample rate in Hz. Non-positive or NaN rates are ignored.

Definition at line 58 of file StereoWidth.h.

◆ process()

template<FloatType T>
void dspark::StereoWidth< T >::process ( T *  left,
T *  right,
int  numSamples 
)
inlinenoexcept

Process a full block of audio. Optimized for SIMD vectorization.

Parameters
leftPointer to left channel data.
rightPointer to right channel data.
numSamplesNumber of samples to process.

Definition at line 118 of file StereoWidth.h.

◆ processBlock()

template<FloatType T>
void dspark::StereoWidth< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes an AudioBufferView in-place.

Parameters
bufferAudio buffer (must have >= 2 channels).

Definition at line 73 of file StereoWidth.h.

◆ reset()

template<FloatType T>
void dspark::StereoWidth< T >::reset ( )
inlinenoexcept

Clears the internal filter states to prevent artifact ringing.

Definition at line 167 of file StereoWidth.h.

◆ setBassMono()

template<FloatType T>
void dspark::StereoWidth< T >::setBassMono ( bool  enabled,
double  cutoffHz = 100.0 
)
inlinenoexcept

Toggles Bass Mono and updates the crossover frequency.

Parameters
enabledTrue activates the phase-aligned bass mono crossover.
cutoffHzCutoff frequency in Hz (default: 100.0). Non-positive or NaN cutoffs keep the previous crossover (a NaN here poisoned the side filter state permanently); the enabled toggle still applies.

Definition at line 102 of file StereoWidth.h.

◆ setState()

template<FloatType T>
bool dspark::StereoWidth< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores parameters from a blob (tolerant; rejects foreign ids).

Definition at line 184 of file StereoWidth.h.

◆ setWidth()

template<FloatType T>
void dspark::StereoWidth< T >::setWidth ( width)
inlinenoexcept

Sets the overall stereo width factor.

Parameters
width0.0 = Mono, 1.0 = Original, >1.0 = Widened. Non-finite values are ignored (without the guard, max(0, NaN) resolved to 0: a silent collapse to mono).

Definition at line 85 of file StereoWidth.h.

◆ updateBassMonoCoeff()

template<FloatType T>
void dspark::StereoWidth< T >::updateBassMonoCoeff ( double  cutoff)
inlineprotectednoexcept

Definition at line 195 of file StereoWidth.h.


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