6#ifndef SBL_DSP_DYNAMICS_DRY_WET_HPP_
7#define SBL_DSP_DYNAMICS_DRY_WET_HPP_
54 static float mix(
float dry,
float wet,
float mix) {
61 return dry +
mix * (wet - dry);
82 template<
class... Ports>
83 void process(
const float* wet,
float* out, uint16_t frames, Ports... ports) {
84 static_assert(
sizeof...(Ports) >= 1 && transport::fits_v<DryWet, Ports...>,
85 "SBL ERROR: DryWet takes dry (a block), then mix (a block or a scalar)");
86 const auto dry = transport::arg<0>(ports...);
87 const auto amount = transport::arg<1>(ports...);
88 if constexpr (transport::is_scalar_v<
decltype(amount)>) {
92 for (uint16_t i = 0; i < frames; ++i) {
93 if constexpr (transport::is_block_v<
decltype(amount)>) {
98 out[i] =
mix(dry[i], wet[i], m);
100 if constexpr (transport::is_block_v<
decltype(amount)>) {
A dry/wet mix of two signals, the mix a port.
static float mix(float dry, float wet, float mix)
One frame: dry at a mix of 0, wet at 1. The mix is used as given.
static constexpr uint16_t RAMP_FRAMES
DryWet()
A mix of 1, the wet signal, until a mix is given; a scalar mix ramps over RAMP_FRAMES.
void process(const float *wet, float *out, uint16_t frames, Ports... ports)
The mix over a buffer: the wet signal is the input, dry and mix are ports.
void reset()
The mix at its target.
static constexpr transport::Port PORTS[]
The ports of the buffer form, in the order it takes them.
A linear ramp to a target over a fixed number of frames.
float target() const
The value the ramp heads for.
void head(float target)
set(), except that the first value given since construction, by head() or jump(), is arrived at at on...
void jump(float value)
Arrive at a value at once.
void set_length(uint16_t frames)
Set how many frames a ramp takes.
constexpr T clamp01(T x)
x held to [0, 1]; a NaN goes to 0.
A linear ramp to a target over a fixed number of frames.
The processing call's shape as a checked contract.