|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
One bucket-brigade delay line (one channel). More...
#include <BucketBrigade.h>
Public Types | |
| enum class | Precision { Standard , High } |
| How the line reads its input and its output (setPrecision()). More... | |
| enum class | Shape { Butterworth , Chorus } |
| The pair of filters around the chain (setShape()). More... | |
Public Member Functions | |
| void | prepare (double sampleRate, int stages, double cornerHz, int factor=1) |
| Allocates the chain and designs the filters. | |
| void | setShape (Shape shape) noexcept |
| The pair of filters around the chain; takes effect from the next corner set. | |
| Shape | getShape () const noexcept |
| void | reset () noexcept |
| Empties the chain and the filters. | |
| void | setCorner (double hz) noexcept |
| Corner of the input and output low-passes, 200 Hz to 0.45 of the host's rate. | |
| void | setCorners (double inputHz, double outputHz) noexcept |
| Corners of the input and the output low-passes, each 200 Hz to 0.45 of the host's rate (non-finite values are ignored). Set before the line runs (or after prepare()) they take effect at once; while it runs they glide over 32 steps of the line. | |
| void | setCornersNow (double inputHz, double outputHz) noexcept |
| The corners taken at once, without the glide: for an owner that moves them every sample itself. Non-finite values are ignored. | |
| int | getStages () const noexcept |
| double | getCorner () const noexcept |
| double | getOutputCorner () const noexcept |
| int | getFactor () const noexcept |
| void | setPrecision (Precision precision) noexcept |
| How the line reads its input and its output (out-of-range values read as Standard); call reset() after a change. | |
| Precision | getPrecision () const noexcept |
| double | clockFor (double delaySeconds) const noexcept |
| The clock rate a delay needs, in hertz. | |
| double | delayFor (double wantedSeconds) const noexcept |
The delay to ask of processSample() for the whole device to be late by wantedSeconds. | |
| T | processSample (T input, double delaySeconds) noexcept |
| One host sample through the device. | |
| void | processPair (BucketBrigade &twin, T input, double delayThis, double delayTwin, double &outThis, double &outTwin) noexcept |
| One host sample through this line and a twin, sharing this line's input low-pass (the twin's own is not used). | |
Static Public Attributes | |
| static constexpr int | kMinStages = 64 |
| Smallest chain. | |
| static constexpr int | kMaxStages = 8192 |
| Largest chain. | |
One bucket-brigade delay line (one channel).
| T | Sample type (float or double); the chain and the filters run in double. |
Definition at line 88 of file BucketBrigade.h.
|
strong |
How the line reads its input and its output (setPrecision()).
Definition at line 95 of file BucketBrigade.h.
|
strong |
The pair of filters around the chain (setShape()).
| Enumerator | |
|---|---|
| Butterworth | Fourth-order Butterworth low-passes at the input and the output (default). |
| Chorus | Two sections of Q 0.8 at the input; a mean of two steps and a section of Q 0.6 at the output. |
Definition at line 124 of file BucketBrigade.h.
|
inlinenoexcept |
The clock rate a delay needs, in hertz.
Definition at line 207 of file BucketBrigade.h.
|
inlinenoexcept |
The delay to ask of processSample() for the whole device to be late by wantedSeconds.
The chain is not all of the device's delay: its two low-passes add their group delay (that of two fourth-order Butterworth filters at the corner, taken at low frequencies), the held output half a clock period (the chain's delay over its number of stages) and the average over the step half a step (three and a half in high precision, which reads its input two steps back and weighs its output over three). This takes them off, so an echo lands on its time.
| wantedSeconds | The delay from the input to the output. |
Definition at line 227 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 192 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 196 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 194 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 204 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 145 of file BucketBrigade.h.
|
inlinenoexcept |
Definition at line 190 of file BucketBrigade.h.
|
inline |
Allocates the chain and designs the filters.
| sampleRate | Host rate (invalid values are ignored). |
| stages | Stages of the device (rounded to an even count, 64 to 8192). |
| cornerHz | Corner of the input and output low-passes. |
| factor | 1 runs the line at the host's rate; 2 at twice it (see the file notes); other values read as 1. |
Definition at line 109 of file BucketBrigade.h.
|
inlinenoexcept |
One host sample through this line and a twin, sharing this line's input low-pass (the twin's own is not used).
The twin must have been prepared like this line (rate, stages, factor) and carry the same corner; each line then gives what processSample() would give it on the same input.
| twin | The other line. |
| input | The sample, the same for both. |
| delayThis | The delay of this line at this sample. |
| delayTwin | The delay of the twin at this sample. |
| outThis | Receives this line's output. |
| outTwin | Receives the twin's output. |
Definition at line 268 of file BucketBrigade.h.
|
inlinenoexcept |
One host sample through the device.
| input | The sample. |
| delaySeconds | The delay the clock is set for at this sample (N / (2 f_clk); at most 64 clock ticks per sample). |
Definition at line 245 of file BucketBrigade.h.
|
inlinenoexcept |
Empties the chain and the filters.
Definition at line 148 of file BucketBrigade.h.
|
inlinenoexcept |
Corner of the input and output low-passes, 200 Hz to 0.45 of the host's rate.
Definition at line 163 of file BucketBrigade.h.
|
inlinenoexcept |
Corners of the input and the output low-passes, each 200 Hz to 0.45 of the host's rate (non-finite values are ignored). Set before the line runs (or after prepare()) they take effect at once; while it runs they glide over 32 steps of the line.
Definition at line 171 of file BucketBrigade.h.
|
inlinenoexcept |
The corners taken at once, without the glide: for an owner that moves them every sample itself. Non-finite values are ignored.
Definition at line 184 of file BucketBrigade.h.
|
inlinenoexcept |
How the line reads its input and its output (out-of-range values read as Standard); call reset() after a change.
Definition at line 199 of file BucketBrigade.h.
|
inlinenoexcept |
The pair of filters around the chain; takes effect from the next corner set.
Definition at line 131 of file BucketBrigade.h.
|
staticconstexpr |
Largest chain.
Definition at line 92 of file BucketBrigade.h.
|
staticconstexpr |
Smallest chain.
Definition at line 91 of file BucketBrigade.h.