set harder limits for gains in bw_{gain,hs1,hs2,ls1,ls2,peak}
This commit is contained in:
parent
34402d720e
commit
524ce724bc
1
TODO
1
TODO
@ -73,6 +73,7 @@ code:
|
||||
* modulation vs process (multi) no update (post 1.0.0)???
|
||||
* reset_state_multi allow NULL input?
|
||||
* process allow NULL output?
|
||||
* #if __cplusplus >= 201103L ? - see https://stackoverflow.com/questions/5047971/how-do-i-check-for-c11-support
|
||||
|
||||
build system:
|
||||
* make makefiles handle paths with spaces etc
|
||||
|
@ -186,7 +186,7 @@ static inline void bw_gain_set_gain_dB(
|
||||
/*! <<<```
|
||||
* Sets the gain parameter to the given `value` (dB) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite if positive.
|
||||
* `value` must be less than or equal to `770.630f`.
|
||||
*
|
||||
* Default value: `0.f`.
|
||||
*
|
||||
@ -426,7 +426,7 @@ static inline void bw_gain_set_gain_dB(
|
||||
BW_ASSERT_DEEP(bw_gain_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_gain_coeffs_state_init);
|
||||
BW_ASSERT(!bw_is_nan(value));
|
||||
BW_ASSERT(value > 0.f ? bw_is_finite(value) : 1);
|
||||
BW_ASSERT(value <= 770.630f);
|
||||
|
||||
coeffs->gain = bw_dB2linf(value);
|
||||
|
||||
|
@ -252,7 +252,7 @@ static inline void bw_hs1_set_high_gain_lin(
|
||||
* Sets the high-frequency gain parameter to the given `value` (linear gain)
|
||||
* in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and non-negative.
|
||||
* Valid range: [`1e-30f`, `1e30f`].
|
||||
*
|
||||
* By the time `bw_hs1_update_coeffs_ctrl()`, `bw_hs1_update_coeffs_audio()`,
|
||||
* `bw_hs1_process1()`, `bw_hs1_process()`, or `bw_hs1_process_multi()` is
|
||||
@ -269,7 +269,7 @@ static inline void bw_hs1_set_high_gain_dB(
|
||||
* Sets the high-frequency gain parameter to the given `value` (dB) in
|
||||
* `coeffs`.
|
||||
*
|
||||
* `value` must be finite if positive.
|
||||
* Valid range: [`-600.f`, `600.f`].
|
||||
*
|
||||
* By the time `bw_hs1_update_coeffs_ctrl()`, `bw_hs1_update_coeffs_audio()`,
|
||||
* `bw_hs1_process1()`, `bw_hs1_process()`, or `bw_hs1_process_multi()` is
|
||||
@ -630,7 +630,7 @@ static inline void bw_hs1_set_high_gain_lin(
|
||||
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
BW_ASSERT(value >= 1e-30f && value <= 1e30f);
|
||||
|
||||
if (value != coeffs->high_gain) {
|
||||
coeffs->high_gain = value;
|
||||
@ -648,7 +648,7 @@ static inline void bw_hs1_set_high_gain_dB(
|
||||
BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value > 0.f ? bw_is_finite(value) : 1);
|
||||
BW_ASSERT(value >= -600.f && value <= 600.f);
|
||||
|
||||
bw_hs1_set_high_gain_lin(coeffs, bw_dB2linf(value));
|
||||
|
||||
@ -673,7 +673,7 @@ static inline char bw_hs1_coeffs_is_valid(
|
||||
return 0;
|
||||
if (coeffs->prewarp_freq < 1e-6f || coeffs->prewarp_freq > 1e12f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->high_gain) || coeffs->high_gain < 0.f)
|
||||
if (!bw_is_finite(coeffs->high_gain) || coeffs->high_gain < 1e-30f || coeffs->high_gain > 1e30f)
|
||||
return 0;
|
||||
|
||||
return bw_mm1_coeffs_is_valid(&coeffs->mm1_coeffs);
|
||||
|
@ -266,7 +266,7 @@ static inline void bw_hs2_set_high_gain_lin(
|
||||
* Sets the high-frequency gain parameter to the given `value` (linear gain)
|
||||
* in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and non-negative.
|
||||
* Valid range: [`1e-30f`, `1e30f`].
|
||||
*
|
||||
* By the time `bw_hs2_update_coeffs_ctrl()`, `bw_hs2_update_coeffs_audio()`,
|
||||
* `bw_hs2_process1()`, `bw_hs2_process()`, or `bw_hs2_process_multi()` is
|
||||
@ -284,7 +284,7 @@ static inline void bw_hs2_set_high_gain_dB(
|
||||
* Sets the high-frequency gain parameter to the given `value` (dB) in
|
||||
* `coeffs`.
|
||||
*
|
||||
* `value` must be finite if positive.
|
||||
* Valid range: [`-600.f`, `600.f`].
|
||||
*
|
||||
* By the time `bw_hs2_update_coeffs_ctrl()`, `bw_hs2_update_coeffs_audio()`,
|
||||
* `bw_hs2_process1()`, `bw_hs2_process()`, or `bw_hs2_process_multi()` is
|
||||
@ -674,7 +674,7 @@ static inline void bw_hs2_set_high_gain_lin(
|
||||
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= 0.f);
|
||||
BW_ASSERT(value >= 1e-30f && value <= 1e30f);
|
||||
|
||||
if (coeffs->high_gain != value) {
|
||||
coeffs->high_gain = value;
|
||||
@ -695,7 +695,7 @@ static inline void bw_hs2_set_high_gain_dB(
|
||||
BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value > 0.f ? bw_is_finite(value) : 1);
|
||||
BW_ASSERT(value >= -600.f && value <= 600.f);
|
||||
|
||||
bw_hs2_set_high_gain_lin(coeffs, bw_dB2linf(value));
|
||||
|
||||
@ -720,7 +720,7 @@ static inline char bw_hs2_coeffs_is_valid(
|
||||
return 0;
|
||||
if (coeffs->prewarp_freq < 1e-6f || coeffs->prewarp_freq > 1e12f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->high_gain) || coeffs->high_gain < 0.f)
|
||||
if (!bw_is_finite(coeffs->high_gain) || coeffs->high_gain < 1e-30f || coeffs->high_gain > 1e30f)
|
||||
return 0;
|
||||
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
|
@ -253,7 +253,7 @@ static inline void bw_ls1_set_dc_gain_lin(
|
||||
/*! <<<```
|
||||
* Sets the dc gain parameter to the given `value` (linear gain) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and greater than or equal to `1e-30f`.
|
||||
* Valid range: [`1e-30f`, `1e30f`].
|
||||
*
|
||||
* By the time `bw_ls1_update_coeffs_ctrl()`, `bw_ls1_update_coeffs_audio()`,
|
||||
* `bw_ls1_process1()`, `bw_ls1_process()`, or `bw_ls1_process_multi()` is
|
||||
@ -270,7 +270,7 @@ static inline void bw_ls1_set_dc_gain_dB(
|
||||
/*! <<<```
|
||||
* Sets the dc gain parameter to the given `value` (dB) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and greater than or equal to `-600.f`.
|
||||
* Valid range: [`-600.f`, `600.f`].
|
||||
*
|
||||
* By the time `bw_ls1_update_coeffs_ctrl()`, `bw_ls1_update_coeffs_audio()`,
|
||||
* `bw_ls1_process1()`, `bw_ls1_process()`, or `bw_ls1_process_multi()` is
|
||||
@ -631,7 +631,7 @@ static inline void bw_ls1_set_dc_gain_lin(
|
||||
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= 1e-30f);
|
||||
BW_ASSERT(value >= 1e-30f && value <= 1e30f);
|
||||
|
||||
if (value != coeffs->dc_gain) {
|
||||
coeffs->dc_gain = value;
|
||||
@ -649,7 +649,7 @@ static inline void bw_ls1_set_dc_gain_dB(
|
||||
BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= -600.f);
|
||||
BW_ASSERT(value >= -600.f && value <= 600.f);
|
||||
|
||||
bw_ls1_set_dc_gain_lin(coeffs, bw_dB2linf(value));
|
||||
|
||||
@ -674,7 +674,7 @@ static inline char bw_ls1_coeffs_is_valid(
|
||||
return 0;
|
||||
if (coeffs->prewarp_freq < 1e-6f || coeffs->prewarp_freq > 1e12f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->dc_gain) || coeffs->dc_gain < 1e-30f)
|
||||
if (!bw_is_finite(coeffs->dc_gain) || coeffs->dc_gain < 1e-30f || coeffs->dc_gain > 1e30f)
|
||||
return 0;
|
||||
|
||||
return bw_mm1_coeffs_is_valid(&coeffs->mm1_coeffs);
|
||||
|
@ -264,7 +264,7 @@ static inline void bw_ls2_set_dc_gain_lin(
|
||||
/*! <<<```
|
||||
* Sets the dc gain parameter to the given `value` (linear gain) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and greater than or equal to `1e-30f`.
|
||||
* Valid range: [`1e-30f`, `1e30f`].
|
||||
*
|
||||
* By the time `bw_ls2_update_coeffs_ctrl()`, `bw_ls2_update_coeffs_audio()`,
|
||||
* `bw_ls2_process1()`, `bw_ls2_process()`, or `bw_ls2_process_multi()` is
|
||||
@ -281,7 +281,7 @@ static inline void bw_ls2_set_dc_gain_dB(
|
||||
/*! <<<```
|
||||
* Sets the dc gain parameter to the given `value` (dB) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite and greater than or equal to `-600.f`.
|
||||
* Valid range: [`-600.f`, `600.f`].
|
||||
*
|
||||
* By the time `bw_ls2_update_coeffs_ctrl()`, `bw_ls2_update_coeffs_audio()`,
|
||||
* `bw_ls2_process1()`, `bw_ls2_process()`, or `bw_ls2_process_multi()` is
|
||||
@ -667,7 +667,7 @@ static inline void bw_ls2_set_dc_gain_lin(bw_ls2_coeffs *BW_RESTRICT coeffs, flo
|
||||
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= 1e-30f);
|
||||
BW_ASSERT(value >= 1e-30f && value <= 1e30f);
|
||||
|
||||
if (coeffs->dc_gain != value) {
|
||||
coeffs->dc_gain = value;
|
||||
@ -686,7 +686,7 @@ static inline void bw_ls2_set_dc_gain_dB(bw_ls2_coeffs *BW_RESTRICT coeffs, floa
|
||||
BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= -600.f);
|
||||
BW_ASSERT(value >= -600.f && value <= 600.f);
|
||||
|
||||
bw_ls2_set_dc_gain_lin(coeffs, bw_dB2linf(value));
|
||||
|
||||
@ -711,7 +711,7 @@ static inline char bw_ls2_coeffs_is_valid(
|
||||
return 0;
|
||||
if (coeffs->prewarp_freq < 1e-6f || coeffs->prewarp_freq > 1e12f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->dc_gain) || coeffs->dc_gain < 1e-30f)
|
||||
if (!bw_is_finite(coeffs->dc_gain) || coeffs->dc_gain < 1e-30f || coeffs->dc_gain > 1e30f)
|
||||
return 0;
|
||||
|
||||
#ifdef BW_DEBUG_DEEP
|
||||
|
@ -269,13 +269,13 @@ static inline void bw_peak_set_peak_gain_lin(
|
||||
* Sets the peak gain parameter to the given `value` (linear gain) in
|
||||
* `coeffs`.
|
||||
*
|
||||
* `value` must be finite and positive.
|
||||
* Valid range: [`1e-30f`, `1e30f`].
|
||||
*
|
||||
* If actually using the bandwidth parameter to control Q, by the time
|
||||
* `bw_peak_update_coeffs_ctrl()`, `bw_peak_update_coeffs_audio()`,
|
||||
* `bw_peak_process1()`, `bw_peak_process()`, or `bw_peak_process_multi()` is
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain)
|
||||
* * bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain) *
|
||||
* bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
*
|
||||
* Default value: `1.f`.
|
||||
*
|
||||
@ -287,13 +287,13 @@ static inline void bw_peak_set_peak_gain_dB(
|
||||
/*! <<<```
|
||||
* Sets the peak gain parameter to the given `value` (dB) in `coeffs`.
|
||||
*
|
||||
* `value` must be finite.
|
||||
* Valid range: [`-600.f`, `600.f`].
|
||||
*
|
||||
* If actually using the bandwidth parameter to control Q, by the time
|
||||
* `bw_peak_update_coeffs_ctrl()`, `bw_peak_update_coeffs_audio()`,
|
||||
* `bw_peak_process1()`, `bw_peak_process()`, or `bw_peak_process_multi()` is
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain)
|
||||
* * bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain) *
|
||||
* bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
*
|
||||
* Default value: `0.f`.
|
||||
*
|
||||
@ -305,13 +305,13 @@ static inline void bw_peak_set_bandwidth(
|
||||
/*! <<<```
|
||||
* Sets the bandwidth `value` (octaves) in `coeffs`.
|
||||
*
|
||||
* Valid range: [`1e-6f`, `90.f`].
|
||||
*
|
||||
* If actually using the bandwidth parameter to control Q, by the time
|
||||
* `bw_peak_update_coeffs_ctrl()`, `bw_peak_update_coeffs_audio()`,
|
||||
* `bw_peak_process1()`, `bw_peak_process()`, or `bw_peak_process_multi()` is
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain)
|
||||
* * bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
*
|
||||
* Valid range: [`1e-6f`, `90.f`].
|
||||
* called, `bw_sqrtf(bw_pow2f(bandwidth) * peak_gain) *
|
||||
* bw_rcpf(bw_pow2f(bandwidth) - 1.f)` must be in [`1e-6f`, `1e6f`].
|
||||
*
|
||||
* Default value: `2.543106606327224f`.
|
||||
*
|
||||
@ -726,7 +726,7 @@ static inline void bw_peak_set_peak_gain_lin(
|
||||
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value > 0.f);
|
||||
BW_ASSERT(value >= 1e-30f && value <= 1e30f);
|
||||
|
||||
if (coeffs->peak_gain != value) {
|
||||
coeffs->peak_gain = value;
|
||||
@ -747,6 +747,7 @@ static inline void bw_peak_set_peak_gain_dB(
|
||||
BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs));
|
||||
BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_init);
|
||||
BW_ASSERT(bw_is_finite(value));
|
||||
BW_ASSERT(value >= -600.f && value <= 600.f);
|
||||
|
||||
bw_peak_set_peak_gain_lin(coeffs, bw_dB2linf(value));
|
||||
|
||||
@ -805,7 +806,7 @@ static inline char bw_peak_coeffs_is_valid(
|
||||
|
||||
if (!bw_is_finite(coeffs->Q) || coeffs->Q < 1e-6f || coeffs->Q > 1e6f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->peak_gain) || coeffs->peak_gain <= 0.f)
|
||||
if (!bw_is_finite(coeffs->peak_gain) || coeffs->peak_gain < 1e-30f || coeffs->peak_gain > 1e30f)
|
||||
return 0;
|
||||
if (!bw_is_finite(coeffs->bandwidth) || coeffs->bandwidth < 1e-6f || coeffs->bandwidth > 90.f)
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user