now reset_state deals explicitly with initial values

This commit is contained in:
Stefano D'Angelo 2023-09-11 13:29:36 +02:00
parent d9e021aca3
commit 34402d720e
15 changed files with 93 additions and 96 deletions

View File

@ -130,9 +130,9 @@ static inline float bw_ap1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_ap1_reset_state_multi()
* ```>>> */
@ -144,11 +144,11 @@ static inline void bw_ap1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_ap1_update_coeffs_ctrl()
* ```>>> */

View File

@ -127,9 +127,9 @@ static inline float bw_ap2_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_ap2_reset_state_multi()
* ```>>> */
@ -141,11 +141,11 @@ static inline void bw_ap2_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_ap2_update_coeffs_ctrl()
* ```>>> */

View File

@ -128,9 +128,9 @@ static inline float bw_hp1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_hp1_reset_state_multi()
* ```>>> */
@ -142,11 +142,11 @@ static inline void bw_hp1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_hp1_update_coeffs_ctrl()
* ```>>> */

View File

@ -129,9 +129,9 @@ static inline float bw_hs1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_hs1_reset_state_multi()
* ```>>> */
@ -143,11 +143,11 @@ static inline void bw_hs1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_hs1_update_coeffs_ctrl()
* ```>>> */
@ -436,8 +436,7 @@ static inline float bw_hs1_reset_state(
BW_ASSERT(state != NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = x_0;
bw_mm1_reset_state(&coeffs->mm1_coeffs, &state->mm1_state, x_0);
const float y = bw_mm1_reset_state(&coeffs->mm1_coeffs, &state->mm1_state, x_0);
#ifdef BW_DEBUG_DEEP
state->hash = bw_hash_sdbm("bw_hs1_state");

View File

@ -144,11 +144,11 @@ static inline void bw_hs2_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_hs2_update_coeffs_ctrl()
* ```>>> */
@ -462,8 +462,7 @@ static inline float bw_hs2_reset_state(
BW_ASSERT(state != NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = x_0;
bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
const float y = bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
#ifdef BW_DEBUG_DEEP
state->hash = bw_hash_sdbm("bw_hs2_state");

View File

@ -130,9 +130,9 @@ static inline float bw_lp1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_lp1_reset_state_multi()
* ```>>> */
@ -144,11 +144,11 @@ static inline void bw_lp1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_lp1_update_coeffs_ctrl()
* ```>>> */

View File

@ -130,9 +130,9 @@ static inline float bw_ls1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_ls1_reset_state_multi()
* ```>>> */
@ -144,11 +144,11 @@ static inline void bw_ls1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_ls1_update_coeffs_ctrl()
* ```>>> */

View File

@ -129,9 +129,9 @@ static inline float bw_ls2_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_ls2_reset_state_multi()
* ```>>> */
@ -143,11 +143,11 @@ static inline void bw_ls2_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_ls2_update_coeffs_ctrl()
* ```>>> */

View File

@ -126,9 +126,9 @@ static inline float bw_mm1_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_mm1_reset_state_multi()
* ```>>> */
@ -140,11 +140,11 @@ static inline void bw_mm1_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_mm1_update_coeffs_ctrl()
* ```>>> */
@ -403,8 +403,8 @@ static inline float bw_mm1_reset_state(
BW_ASSERT(state != NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = (bw_gain_get_gain_lin(&coeffs->gain_x_coeffs) + bw_gain_get_gain_lin(&coeffs->gain_lp_coeffs)) * x_0;
bw_lp1_reset_state(&coeffs->lp1_coeffs, &state->lp1_state, x_0);
const float y = (bw_gain_get_gain_lin(&coeffs->gain_x_coeffs) + bw_gain_get_gain_lin(&coeffs->gain_lp_coeffs)) * x_0;
#ifdef BW_DEBUG_DEEP
state->hash = bw_hash_sdbm("bw_mm1_state");

View File

@ -126,9 +126,9 @@ static inline float bw_mm2_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_mm2_reset_state_multi()
* ```>>> */
@ -140,11 +140,11 @@ static inline void bw_mm2_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_mm2_update_coeffs_ctrl()
* ```>>> */
@ -452,9 +452,9 @@ static inline float bw_mm2_reset_state(
BW_ASSERT(state != NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = (bw_gain_get_gain_lin(&coeffs->gain_x_coeffs) + bw_gain_get_gain_lin(&coeffs->gain_lp_coeffs)) * x_0;
float lp, bp, hp;
bw_svf_reset_state(&coeffs->svf_coeffs, &state->svf_state, x_0, &lp, &bp, &hp);
const float y = (bw_gain_get_gain_lin(&coeffs->gain_x_coeffs) + bw_gain_get_gain_lin(&coeffs->gain_lp_coeffs)) * x_0;
#ifdef BW_DEBUG_DEEP
state->hash = bw_hash_sdbm("bw_mm2_state");

View File

@ -127,9 +127,9 @@ static inline float bw_notch_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_notch_reset_state_multi()
* ```>>> */
@ -141,11 +141,11 @@ static inline void bw_notch_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_notch_update_coeffs_ctrl()
* ```>>> */

View File

@ -156,9 +156,9 @@ static inline float bw_one_pole_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_one_pole_reset_state_multi()
* ```>>> */
@ -170,10 +170,10 @@ static inline void bw_one_pole_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* The corresponding initial output values are written into the
* `y_0` array, if not `NULL`.
*
* #### bw_one_pole_update_coeffs_ctrl()

View File

@ -138,9 +138,9 @@ static inline float bw_peak_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_peak_reset_state_multi()
* ```>>> */
@ -152,11 +152,11 @@ static inline void bw_peak_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* `y_0` array, if not `NULL`.
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_peak_update_coeffs_ctrl()
* ```>>> */
@ -500,8 +500,7 @@ static inline float bw_peak_reset_state(
BW_ASSERT(state != NULL);
BW_ASSERT(bw_is_finite(x_0));
const float y = x_0;
bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
const float y = bw_mm2_reset_state(&coeffs->mm2_coeffs, &state->mm2_state, x_0);
#ifdef BW_DEBUG_DEEP
state->hash = bw_hash_sdbm("bw_peak_state");

View File

@ -132,9 +132,9 @@ static inline float bw_slew_lim_reset_state(
float x_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/equilibrium value `x_0`.
* and the initial input value `x_0`.
*
* Returns the corresponding quiescent/initial output value.
* Returns the corresponding initial output value.
*
* #### bw_slew_lim_reset_state_multi()
* ```>>> */
@ -146,10 +146,10 @@ static inline void bw_slew_lim_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial output values are written into the
* The corresponding initial output values are written into the
* `y_0` array, if not `NULL`.
*
* #### bw_slew_lim_update_coeffs_ctrl()

View File

@ -162,10 +162,10 @@ static inline void bw_svf_reset_state(
float * BW_RESTRICT y_hp_0);
/*! <<<```
* Resets the given `state` to its initial values using the given `coeffs`
* and the quiescent/initial input value `x_0`.
* and the initial input value `x_0`.
*
* The corresponding quiescent/initial lowpass, bandpass, and highpass output
* values are put into `y_lp_0`, `y_bp_0`, and `y_hp_0` respectively.
* The corresponding initial lowpass, bandpass, and highpass output values
* are put into `y_lp_0`, `y_bp_0`, and `y_hp_0` respectively.
*
* #### bw_svf_reset_state_multi()
* ```>>> */
@ -179,12 +179,12 @@ static inline void bw_svf_reset_state_multi(
size_t n_channels);
/*! <<<```
* Resets each of the `n_channels` `state`s to its initial values using the
* given `coeffs` and the corresponding quiescent/initial input value in the
* `x_0` array.
* given `coeffs` and the corresponding initial input value in the `x_0`
* array.
*
* The corresponding quiescent/initial lowpass, bandpass, and highpass output
* values are put into `y_lp_0`, `y_bp_0`, and `y_hp_0` respectively, if they
* are not `NULL`.
* The corresponding initial lowpass, bandpass, and highpass output values
* are put into `y_lp_0`, `y_bp_0`, and `y_hp_0` respectively, if they are
* not `NULL`.
*
* #### bw_svf_update_coeffs_ctrl()
* ```>>> */