45 lines
2.1 KiB
Markdown
45 lines
2.1 KiB
Markdown
# Signalsmith Basics
|
|
|
|
A collection of basic effects, available as plugins and re-usable open-source (MIT) C++ classes.
|
|
|
|
* **Limiter**
|
|
* **Crunch**
|
|
* **Reverb**
|
|
|
|
## How to use
|
|
|
|
Each effect can be used just by including the corresponding header (e.g. `limiter.h`). This defines two classes `LimiterFloat` and `LimiterDouble`. Some of these have initialisation arguments (e.g. maximum lookahead) but these are always optional.
|
|
|
|
```cpp
|
|
// Limiter with maximum attack/lookahead of 100ms
|
|
signalsmith::basics::Limiter effect(100);
|
|
```
|
|
|
|
Before use, these classes must be configured. The `.configure()` method returns `true` if the config was accepted. They can be configured multiple times, but (obviously) not while actively processing audio.
|
|
|
|
```cpp
|
|
effect.configure(sampleRate, maxBlockSize, channels);
|
|
```
|
|
|
|
To process audio, pass in a classic array-of-buffers for input and output (which shouldn't be the same):
|
|
|
|
```cpp
|
|
float **inputBuffers, **outputBuffers;
|
|
int blockSize;
|
|
effect.process(inputBuffers, outputBuffers, blockSize);
|
|
```
|
|
|
|
When playback (re)starts, you can also call `.reset()` to clear any tails/state. You can also inspect latency (`effect.latencySamples()`) and tail length (`effect.tailSamples()`).
|
|
|
|
The actual implementations are templates (e.g. `LimiterSTFX`) which you shouldn't every need to use directly, although they should be fairly readable. These are wrapped up into the `...Float` and `...Double` classes by the code in `stfx/stfx-library.h`, which also provides helpers for parameter-smoothing/etc., and more typical `.configure()` and `.process()` functions (from `.configureSTFX()`/`.processSTFX()`).
|
|
|
|
### Parameters
|
|
|
|
Floating-point parameters are declared as `ParamRange`s in the `...STFX` template. This is an opaque type which can be assigned from / converted into `double` from any thread. Parameter smoothing is handled internally.
|
|
|
|
Integer parameters are declared as `ParamStepped`s. This is a similarly opaque type which converts to/from `int`.
|
|
|
|
### Implementation
|
|
|
|
The `.state()` method of these templates contain a lot of detail, almost all of which is ignored (and optimised away) when using the `...Float`/`...Double` classes.
|