add bw_dry_wet_get_wet(_cur)()

This commit is contained in:
Stefano D'Angelo 2024-03-07 18:45:52 +01:00
parent 93f571af18
commit a4a8ba96ca

View File

@ -20,13 +20,20 @@
/*! /*!
* module_type {{{ dsp }}} * module_type {{{ dsp }}}
* version {{{ 1.1.0 }}} * version {{{ 1.2.0 }}}
* requires {{{ bw_common bw_gain bw_math bw_one_pole }}} * requires {{{ bw_common bw_gain bw_math bw_one_pole }}}
* description {{{ * description {{{
* Dry/wet mixer. * Dry/wet mixer.
* }}} * }}}
* changelog {{{ * changelog {{{
* <ul> * <ul>
* <li>Version <strong>1.2.0</strong>:
* <ul>
* <li>Added <code>bw_dry_wet_get_wet()</code> and
* <code>bw_dry_wet_get_wet_cur()</code>, and corresponding C++
* API.</li>
* </ul>
* </li>
* <li>Version <strong>1.1.0</strong>: * <li>Version <strong>1.1.0</strong>:
* <ul> * <ul>
* <li>Now using <code>BW_NULL</code> and * <li>Now using <code>BW_NULL</code> and
@ -177,6 +184,22 @@ static inline void bw_dry_wet_set_smooth_tau(
* *
* Default value: `0.05f`. * Default value: `0.05f`.
* *
* #### bw_dry_wet_get_wet()
* ```>>> */
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`.
*
* #### bw_dry_wet_get_wet_cur()
* ```>>> */
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.
*
* #### bw_dry_wet_coeffs_is_valid() * #### bw_dry_wet_coeffs_is_valid()
* ```>>> */ * ```>>> */
static inline char bw_dry_wet_coeffs_is_valid( static inline char bw_dry_wet_coeffs_is_valid(
@ -399,6 +422,23 @@ static inline void bw_dry_wet_set_smooth_tau(
BW_ASSERT_DEEP(coeffs->state >= bw_dry_wet_coeffs_state_init); BW_ASSERT_DEEP(coeffs->state >= bw_dry_wet_coeffs_state_init);
} }
static inline float bw_dry_wet_get_wet(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs) {
BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_dry_wet_coeffs_is_valid(coeffs));
return bw_gain_get_gain_lin(&coeffs->gain_coeffs);
}
static inline float bw_dry_wet_get_wet_cur(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs) {
BW_ASSERT(coeffs != BW_NULL);
BW_ASSERT_DEEP(bw_dry_wet_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_dry_wet_coeffs_state_reset_coeffs);
return bw_gain_get_gain_cur(&coeffs->gain_coeffs);
}
static inline char bw_dry_wet_coeffs_is_valid( static inline char bw_dry_wet_coeffs_is_valid(
const bw_dry_wet_coeffs * BW_RESTRICT coeffs) { const bw_dry_wet_coeffs * BW_RESTRICT coeffs) {
BW_ASSERT(coeffs != BW_NULL); BW_ASSERT(coeffs != BW_NULL);
@ -456,6 +496,10 @@ public:
void setSmoothTau( void setSmoothTau(
float value); float value);
float getWet();
float getWetCur();
/*! <<<... /*! <<<...
* } * }
* ``` * ```
@ -518,6 +562,16 @@ inline void DryWet<N_CHANNELS>::setSmoothTau(
bw_dry_wet_set_smooth_tau(&coeffs, value); bw_dry_wet_set_smooth_tau(&coeffs, value);
} }
template<size_t N_CHANNELS>
inline float DryWet<N_CHANNELS>::getWet() {
return bw_dry_wet_get_wet(&coeffs);
}
template<size_t N_CHANNELS>
inline float DryWet<N_CHANNELS>::getWetCur() {
return bw_dry_wet_get_wet_cur(&coeffs);
}
} }
#endif #endif