|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Multi-band compressor: crossover split, per-band compression, sum. More...
#include <MultibandCompressor.h>
Public Member Functions | |
| void | prepare (const AudioSpec &spec) |
| Prepares the multiband compressor and internal buffers for processing. | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes audio through the multi-band compressor. | |
| void | setNumBands (int n) noexcept |
| Sets the number of active frequency bands. | |
| void | setNumBandsKeepingSplits (int n) noexcept |
| Sets the number of active bands keeping the split frequencies (see CrossoverFilter::setNumBandsKeepingSplits()). Safe from any thread. | |
| void | setCrossoverFrequency (int index, T freqHz) noexcept |
| Sets the crossover frequency for a specific split point. | |
| void | setOrder (int order) noexcept |
| Sets the crossover slope in dB/oct: 12, 24 or 48. | |
| void | setCrossoverMode (typename CrossoverFilter< T, MaxBands >::FilterMode mode) noexcept |
| Sets the phase/processing mode of the crossover (IIR or linear-phase). | |
| void | setCrossoverStructure (typename CrossoverFilter< T, MaxBands >::Structure structure) noexcept |
| How the sections of the minimum-phase crossover are realised (see CrossoverFilter::setStructure(); any thread). | |
| void | setCrossoverTopology (typename CrossoverFilter< T, MaxBands >::Topology topology) noexcept |
| Cascade or balanced arrangement of the minimum-phase splits (see CrossoverFilter::setTopology(); any thread). | |
| Compressor< T > & | getBandCompressor (int band) noexcept |
| Direct access to a band's compressor for full configuration. | |
| const Compressor< T > & | getBandCompressor (int band) const noexcept |
| Direct constant access to a band's compressor for state queries. | |
| void | setMix (T amount) noexcept |
| The mix of every band at once, 0 (dry) to 1 (any thread). | |
| void | setBandThreshold (int band, T dB) noexcept |
| Sets the threshold for a specific band. | |
| void | setBandRatio (int band, T ratio) noexcept |
| Sets the ratio for a specific band. | |
| void | setBandAttack (int band, T ms) noexcept |
| Sets the attack time for a specific band. | |
| void | setBandRelease (int band, T ms) noexcept |
| Sets the release time for a specific band. | |
| T | getBandGainReductionDb (int band) const noexcept |
| Gets the current gain reduction applied to a specific band. | |
| int | getNumBands () const noexcept |
| Returns the current number of active bands. | |
| T | getCrossoverFrequency (int index) const noexcept |
Returns the target frequency of split point index in Hz. | |
| int | getOrder () const noexcept |
| Returns the crossover slope in dB/oct (12, 24 or 48). | |
| CrossoverFilter< T, MaxBands >::FilterMode | getCrossoverMode () const noexcept |
| Returns the crossover processing mode (IIR or linear-phase). | |
| CrossoverFilter< T, MaxBands >::Structure | getCrossoverStructure () const noexcept |
| Returns the structure of the minimum-phase crossover. | |
| CrossoverFilter< T, MaxBands >::Topology | getCrossoverTopology () const noexcept |
| Returns the arrangement of the minimum-phase splits. | |
| int | getLatency () const noexcept |
| Returns the total latency of the multi-band system. | |
| void | reset () noexcept |
| Resets all internal states (envelopes, delay lines, etc.). | |
| std::vector< uint8_t > | getState () const |
| Serializes crossover topology and per-band compressor states. | |
| bool | setState (const uint8_t *data, size_t size) |
| Restores topology and band compressors from a blob. | |
Multi-band compressor: crossover split, per-band compression, sum.
| T | Sample type (float or double). |
| MaxBands | Maximum number of bands (compile-time, default 12). |
Definition at line 59 of file MultibandCompressor.h.
|
inlinenoexcept |
Direct constant access to a band's compressor for state queries.
| band | Band index. Clamped safely to valid range in release mode. |
Definition at line 272 of file MultibandCompressor.h.
|
inlinenoexcept |
Direct access to a band's compressor for full configuration.
| band | Band index. Clamped safely to valid range in release mode. |
Definition at line 260 of file MultibandCompressor.h.
|
inlinenoexcept |
Gets the current gain reduction applied to a specific band.
Metering read, safe from any thread. Bands that are currently disabled report the value frozen from when they were last active.
| band | Target band index. |
Definition at line 349 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the target frequency of split point index in Hz.
Definition at line 359 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the crossover processing mode (IIR or linear-phase).
Definition at line 368 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the structure of the minimum-phase crossover.
Definition at line 374 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the arrangement of the minimum-phase splits.
Definition at line 380 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the total latency of the multi-band system.
Definition at line 386 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the current number of active bands.
Definition at line 356 of file MultibandCompressor.h.
|
inlinenoexcept |
Returns the crossover slope in dB/oct (12, 24 or 48).
Definition at line 365 of file MultibandCompressor.h.
|
inline |
Serializes crossover topology and per-band compressor states.
Definition at line 406 of file MultibandCompressor.h.
|
inline |
Prepares the multiband compressor and internal buffers for processing.
Invalid specs (non-positive/non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through. May allocate; setup thread only.
| spec | The audio specification (sample rate, max block size, channels). |
Definition at line 75 of file MultibandCompressor.h.
|
inlinenoexcept |
Processes audio through the multi-band compressor.
Pass-through until prepare() succeeds. A block longer than the prepared maxBlockSize is processed in consecutive chunks of that size (the tail of an oversized block used to be left unprocessed: dry, unfiltered); channels beyond the prepared count pass through.
| buffer | In/Out audio buffer view. |
Definition at line 102 of file MultibandCompressor.h.
|
inlinenoexcept |
Resets all internal states (envelopes, delay lines, etc.).
Definition at line 398 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the attack time for a specific band.
| band | Target band index. |
| ms | Attack time in milliseconds. |
Definition at line 321 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the ratio for a specific band.
| band | Target band index. |
| ratio | Compression ratio (e.g., 4.0 for 4:1). |
Definition at line 310 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the release time for a specific band.
| band | Target band index. |
| ms | Release time in milliseconds. |
Definition at line 332 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the threshold for a specific band.
| band | Target band index. |
| dB | Threshold in decibels. |
Definition at line 299 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the crossover frequency for a specific split point.
| index | Split point index (0 is between band 0 and 1). |
| freqHz | Target frequency in Hertz (non-finite values are ignored). |
Definition at line 205 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the phase/processing mode of the crossover (IIR or linear-phase).
Linear phase adds the crossover's fixed latency (3072 samples at 48 kHz, whatever the block size; see CrossoverFilter::getLatency()), which getLatency() includes.
| mode | Selected filter mode from the CrossoverFilter enum. |
Definition at line 228 of file MultibandCompressor.h.
|
inlinenoexcept |
How the sections of the minimum-phase crossover are realised (see CrossoverFilter::setStructure(); any thread).
| structure | DirectForm (default) or Ladder. |
Definition at line 238 of file MultibandCompressor.h.
|
inlinenoexcept |
Cascade or balanced arrangement of the minimum-phase splits (see CrossoverFilter::setTopology(); any thread).
| topology | Cascade (default) or Balanced. |
Definition at line 248 of file MultibandCompressor.h.
|
inlinenoexcept |
The mix of every band at once, 0 (dry) to 1 (any thread).
Each band blends with itself as the crossover leaves it, so the sum is the programme through the crossover's phase blended with the compressed bands: a mix of one half is as flat as the crossover is. It sets each band's Compressor::setMix().
Definition at line 287 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the number of active frequency bands.
Safe from any thread. A live change fades over (see CrossoverFilter::setNumBands) and re-initialises ALL split frequencies to the crossover's log-spaced defaults - reapply custom frequencies afterwards, or use setNumBandsKeepingSplits(). Compressors of newly enabled bands are reset on the audio thread so they start clean.
| n | Number of bands (clamped between 2 and MaxBands - a crossover needs at least one split point). |
Definition at line 185 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the number of active bands keeping the split frequencies (see CrossoverFilter::setNumBandsKeepingSplits()). Safe from any thread.
| n | Number of bands (clamped between 2 and MaxBands). |
Definition at line 195 of file MultibandCompressor.h.
|
inlinenoexcept |
Sets the crossover slope in dB/oct: 12, 24 or 48.
| order | Slope in dB/oct; other values are ignored (see CrossoverFilter::setOrder). |
Definition at line 214 of file MultibandCompressor.h.
|
inline |
Restores topology and band compressors from a blob.
Definition at line 430 of file MultibandCompressor.h.