DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::CabinetModel< T, MaxChannels > Class Template Reference

A loudspeaker cabinet: colour filters, sparse reflections and two diffusers, with no latency. More...

#include <CabinetModel.h>

Public Member Functions

void prepare (double sampleRate, int numChannels)
 Prepares the model for a sample rate and a channel count, and clears it. Invalid values are ignored. Allocates; setup thread.
 
void reset () noexcept
 Clears the filters and the reflections (settings are kept).
 
void setSize (T size) noexcept
 Size of the box, 0 to 1: the cone's resonance from 140 Hz (0) down to 70 Hz (1). Default 0.5 (99 Hz).
 
void setBrightness (T brightness) noexcept
 Brightness of the speaker, 0 to 1: the roll-off from 3 kHz (0) up to 7 kHz (1), with the breakup peak at 0.62 of it. Default 0.5.
 
void setDistance (T distance) noexcept
 Distance of the microphone, 0 to 1: how much of the box's reflections comes with the direct sound (0: none). Default 0.3.
 
T getSize () const noexcept
 
T getBrightness () const noexcept
 
T getDistance () const noexcept
 
double getResonanceHz () const noexcept
 The cone's resonance for the size set, in hertz.
 
double getRollOffHz () const noexcept
 The roll-off corner for the brightness set, in hertz.
 
void writeState (StateWriter &w, const char *prefix) const
 Writes the settings under keys that start with a prefix.
 
void readState (const StateReader &r, const char *prefix) noexcept
 Reads what writeState() wrote (missing keys read as the defaults).
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Runs a block in place. Channels beyond the prepared count pass through.
 

Static Public Attributes

static constexpr int kTaps = 6
 Reflections of the box.
 
static constexpr int kSections = 5
 Sections of the colour filters.
 

Detailed Description

template<FloatType T, int MaxChannels = 16>
class dspark::CabinetModel< T, MaxChannels >

A loudspeaker cabinet: colour filters, sparse reflections and two diffusers, with no latency.

Template Parameters
TSample type (float or double).
MaxChannelsLargest number of channels.

Definition at line 72 of file CabinetModel.h.

Member Function Documentation

◆ getBrightness()

template<FloatType T, int MaxChannels = 16>
T dspark::CabinetModel< T, MaxChannels >::getBrightness ( ) const
inlinenoexcept

Definition at line 146 of file CabinetModel.h.

◆ getDistance()

template<FloatType T, int MaxChannels = 16>
T dspark::CabinetModel< T, MaxChannels >::getDistance ( ) const
inlinenoexcept

Definition at line 147 of file CabinetModel.h.

◆ getResonanceHz()

template<FloatType T, int MaxChannels = 16>
double dspark::CabinetModel< T, MaxChannels >::getResonanceHz ( ) const
inlinenoexcept

The cone's resonance for the size set, in hertz.

Definition at line 150 of file CabinetModel.h.

◆ getRollOffHz()

template<FloatType T, int MaxChannels = 16>
double dspark::CabinetModel< T, MaxChannels >::getRollOffHz ( ) const
inlinenoexcept

The roll-off corner for the brightness set, in hertz.

Definition at line 152 of file CabinetModel.h.

◆ getSize()

template<FloatType T, int MaxChannels = 16>
T dspark::CabinetModel< T, MaxChannels >::getSize ( ) const
inlinenoexcept

Definition at line 145 of file CabinetModel.h.

◆ prepare()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::prepare ( double  sampleRate,
int  numChannels 
)
inline

Prepares the model for a sample rate and a channel count, and clears it. Invalid values are ignored. Allocates; setup thread.

Definition at line 82 of file CabinetModel.h.

◆ processBlock()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Runs a block in place. Channels beyond the prepared count pass through.

Definition at line 182 of file CabinetModel.h.

◆ readState()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::readState ( const StateReader &  r,
const char *  prefix 
)
inlinenoexcept

Reads what writeState() wrote (missing keys read as the defaults).

Definition at line 170 of file CabinetModel.h.

◆ reset()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::reset ( )
inlinenoexcept

Clears the filters and the reflections (settings are kept).

Definition at line 107 of file CabinetModel.h.

◆ setBrightness()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::setBrightness ( T  brightness)
inlinenoexcept

Brightness of the speaker, 0 to 1: the roll-off from 3 kHz (0) up to 7 kHz (1), with the breakup peak at 0.62 of it. Default 0.5.

Definition at line 129 of file CabinetModel.h.

◆ setDistance()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::setDistance ( T  distance)
inlinenoexcept

Distance of the microphone, 0 to 1: how much of the box's reflections comes with the direct sound (0: none). Default 0.3.

Definition at line 139 of file CabinetModel.h.

◆ setSize()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::setSize ( T  size)
inlinenoexcept

Size of the box, 0 to 1: the cone's resonance from 140 Hz (0) down to 70 Hz (1). Default 0.5 (99 Hz).

Definition at line 119 of file CabinetModel.h.

◆ writeState()

template<FloatType T, int MaxChannels = 16>
void dspark::CabinetModel< T, MaxChannels >::writeState ( StateWriter &  w,
const char *  prefix 
) const
inline

Writes the settings under keys that start with a prefix.

Definition at line 158 of file CabinetModel.h.

Member Data Documentation

◆ kSections

template<FloatType T, int MaxChannels = 16>
constexpr int dspark::CabinetModel< T, MaxChannels >::kSections = 5
staticconstexpr

Sections of the colour filters.

Definition at line 76 of file CabinetModel.h.

◆ kTaps

template<FloatType T, int MaxChannels = 16>
constexpr int dspark::CabinetModel< T, MaxChannels >::kTaps = 6
staticconstexpr

Reflections of the box.

Definition at line 75 of file CabinetModel.h.


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