fix bw_env_gen_reset_state (gate_0) + fix doc

This commit is contained in:
Stefano D'Angelo 2023-09-28 13:31:20 +02:00
parent e49cae6c8b
commit dad7485016
5 changed files with 16 additions and 3 deletions

View File

@ -268,6 +268,8 @@ static inline size_t bw_delay_get_length(
/*! <<<```
* Returns the length of the delay line in samples as stored in `coeffs`.
*
* `coeffs` must be at least in the "sample-rate-set" state.
*
* #### bw_delay_coeffs_is_valid()
* ```>>> */
static inline char bw_delay_coeffs_is_valid(

View File

@ -497,15 +497,20 @@ static inline void bw_env_gen_reset_coeffs(
static inline float bw_env_gen_reset_state(
const bw_env_gen_coeffs * BW_RESTRICT coeffs,
bw_env_gen_state * BW_RESTRICT state,
char gate) {
char gate_0) {
BW_ASSERT(coeffs != NULL);
BW_ASSERT_DEEP(bw_env_gen_coeffs_is_valid(coeffs));
BW_ASSERT_DEEP(coeffs->state >= bw_env_gen_coeffs_state_reset_coeffs);
BW_ASSERT(state != NULL);
bw_one_pole_reset_state(&coeffs->smooth_coeffs, &state->smooth_state, coeffs->sustain);
state->phase = bw_env_gen_phase_off;
state->v = gate ? coeffs->sustain_v : 0;
if (gate_0) {
state->phase = bw_env_gen_phase_sustain;
state->v = coeffs->sustain_v;
} else {
state->phase = bw_env_gen_phase_off;
state->v = 0;
}
const float y = (1.f / (float)BW_ENV_V_MAX) * state->v;
#ifdef BW_DEBUG_DEEP

View File

@ -216,6 +216,8 @@ static inline float bw_gain_get_gain_cur(
/*! <<<```
* Returns the actual current gain coefficient (linear gain) in `coeffs`.
*
* `coeffs` must be at least in the "reset" state.
*
* #### bw_gain_coeffs_is_valid()
* ```>>> */
static inline char bw_gain_coeffs_is_valid(

View File

@ -188,6 +188,8 @@ static inline float bw_noise_gen_get_scaling_k(
* Returns the sample rate scaling factor that is applied or would be applied
* if sample rate scaling were enabled, as stored in `coeffs`.
*
* `coeffs` must be at least inthe "sample-rate-set" state.
*
* #### bw_noise_gen_coeffs_is_valid()
* ```>>> */
static inline char bw_noise_gen_coeffs_is_valid(

View File

@ -266,6 +266,8 @@ static inline float bw_pink_filt_get_scaling_k(
* Returns the sample rate scaling factor that is applied or would be applied
* if sample rate scaling were enabled, as stored in `coeffs`.
*
* `coeffs` must be at least in the "sample-rate-set" state.
*
* #### bw_pink_filt_coeffs_is_valid()
* ```>>> */
static inline char bw_pink_filt_coeffs_is_valid(