Dry/wet mixer.
Version: 1.2.1
License:
Requires:
Included in Brickworks, which is:
Module type: DSP
typedef struct bw_dry_wet_coeffs bw_dry_wet_coeffs;
Coefficients and related.
static inline void bw_dry_wet_init(
bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Initializes input parameter values in coeffs.
static inline void bw_dry_wet_set_sample_rate(
bw_dry_wet_coeffs * BW_RESTRICT coeffs,
float sample_rate);
Sets the sample_rate (Hz) value in coeffs.
static inline void bw_dry_wet_reset_coeffs(
bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Resets coefficients in coeffs to assume their target values.
static inline void bw_dry_wet_update_coeffs_ctrl(
bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Triggers control-rate update of coefficients in coeffs.
static inline void bw_dry_wet_update_coeffs_audio(
bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Triggers audio-rate update of coefficients in coeffs.
static inline float bw_dry_wet_process1(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs,
float x_dry,
float x_wet);
Processes one dry input sample x_dry and one wet input sample x_wet using coeffs and returns the corresponding output sample.
static inline void bw_dry_wet_process(
bw_dry_wet_coeffs * BW_RESTRICT coeffs,
const float * x_dry,
const float * x_wet,
float * y,
size_t n_samples);
Processes the first n_samples of the dry input buffer x_dry and of the wet input buffer x_wet and fills the first n_samples of the output buffer y, while using and updating coeffs (control and audio rate).
static inline void bw_dry_wet_process_multi(
bw_dry_wet_coeffs * BW_RESTRICT coeffs,
const float * const * x_dry,
const float * const * x_wet,
float * const * y,
size_t n_channels,
size_t n_samples);
Processes the first n_samples of the n_channels dry input buffers x_dry and of the n_channels wet input buffers x_wet, and fills the first n_samples of the n_channels output buffers y, while using and updating the common coeffs (control and audio rate).
static inline void bw_dry_wet_set_wet(
bw_dry_wet_coeffs * BW_RESTRICT coeffs,
float value);
Sets the wet gain parameter to the given value (linear gain) in coeffs.
Valid range: [0.f, 1.f].
Default value: 1.f.
static inline void bw_dry_wet_set_smooth_tau(
bw_dry_wet_coeffs * BW_RESTRICT coeffs,
float value);
Sets the smoothing time constant value (s) in coeffs.
value must be non-negative.
Default value: 0.05f.
static inline float bw_dry_wet_get_wet(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Returns the current wet parameter value (linear gain) in coeffs.
static inline float bw_dry_wet_get_wet_cur(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Returns the actual current wet coefficient (linear gain) in coeffs.
coeffs must be at least in the "reset" state.
static inline char bw_dry_wet_coeffs_is_valid(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs);
Tries to determine whether coeffs is valid and returns non-0 if it seems to be the case and 0 if it is certainly not. False positives are possible, false negatives are not.
coeffs must at least point to a readable memory block of size greater than or equal to that of bw_dry_wet_coeffs.
template<size_t N_CHANNELS = 1>
class DryWet {
public:
DryWet();
void setSampleRate(
float sampleRate);
void reset();
void process(
const float * const * xDry,
const float * const * xWet,
float * const * y,
size_t nSamples);
# ifndef BW_CXX_NO_ARRAY
void process(
std::array<const float *, N_CHANNELS> xDry,
std::array<const float *, N_CHANNELS> xWet,
std::array<float *, N_CHANNELS> y,
size_t nSamples);
# endif
void setWet(
float value);
void setSmoothTau(
float value);
float getWet();
float getWetCur();
...
}
N_CHANNELS in C++ API.BW_INCLUDE_WITH_QUOTES, BW_NO_CXX, and BW_CXX_NO_EXTERN_C.bw_dry_wet_process() to bw_dry_wet_process_multi().bw_dry_wet_get_wet() and bw_dry_wet_get_wet_cur(), and corresponding C++ API.bw_dry_wet_process_multi() to ensure that buffers used for both input and output appear at the same channel indices.BW_NULL and BW_CXX_NO_ARRAY.bw_dry_wet_process() and bw_dry_wet_process_multi() now use size_t to count samples and channels.const specifiers to input arguments.process() function taking C-style arrays as arguments.