big cleanup

This commit is contained in:
Stefano D'Angelo 2023-09-27 20:36:11 +02:00
parent 7b968161ec
commit 16d17cb5f4
25 changed files with 151 additions and 15 deletions

View File

@ -1,3 +1,94 @@
1.0.0
-----
* Now using size_t rather than BW_SIZE_T and for counting items.
* Made control over inclusion of standard library headers more explicit via
specific preprocessor definitions.
* Introduced BW_NO_DEBUG and prevented useless inclusion of assert.h.
* Added more const and BW_RESTRICT specifiers to input arguments.
* Removed usage of reserved identifiers and designated initializers.
* Added extern "C" to functions.
* Removed C++ headers and moved C++ code to now-unique C/C++ headers.
* Changed order of arguments to improve consistency in bw_buf.
* Added overloaded C++ functions taking C-style arrays as arguments.
* Added debugging code to all modules and improved existing debugging code.
* Renamed bw_min0xf() as bw_min0f() and bw_max0xf() as bw_max0f().
* Removed precision suffixes from function names in bw_math.
* New implementations for bw_min0f(), bw_max0f(), bw_minf(), bw_maxf(), and
bw_clipf().
* Fixed rounding bug in bw_roundf() when absolute value of input was in [0.5f,
1.f].
* Fixed bw_ceilf() for negative input values.
* Fixed bw_sqrtf() for very large input values and improved implementation.
* Fixed input validity ranges in bw_asinhf() and bw_acoshf().
* Improved documentation w.r.t. validity of input values and approximation
errors.
* Removed redundant status member from bw_note_queue_event.
* Possibly improved memeory layout of bw_note_queue.
* Clarified ambiguity in the documentation of bw_note_queue_status.
* Specified that velocity can be negative in bw_voice_alloc_opts.
* Added bw_*_reset_state_multi() and updated C++ APIs in this regard.
* Now bw_*_reset_state() take initial input values and return initial output
values.
* Fixed output polarity in bw_ap1.
* Added bw_bd_reduce_set_sample_rate().
* Changed default value for gain compensation to off in bw_clip.
* Fixed missing smoothing filter initialization in bw_comp.
* Fixed missing forced coefficients' update in bw_comp_reset_coeffs().
* Improved and strengthened algorithm in bw_comp.
* Removed read() and write() from C++ API in bw_delay.
* Adjusted internal peak cutoff to more sensible value in bw_dist.
* Improved algorithm to be a bit more faithful to the original in bw_drive.
* bw_drywet renamed as bw_dry_wet.
* Renamed bw_env_gen_update_state_ctrl() as bw_env_gen_process_ctrl().
* Faster and more robust implementation in bw_env_gen.
* Added pragmas to silence bogus GCC uninitialized variable warnings.
* Improved algorithm to be a bit more faithful to the original in bw_fuzz.
* Added bw_gain_get_gain_lin().
* Renamed bw_gain_get_gain() as bw_gain_get_gain_cur().
* Simplified implementation to use less memory in bw_gain.
* Added prewarp_at_cutoff and prewarp_freq parameters in bw_ap1, bw_ap2,
bw_hp1, bw_hs1, bw_ls1, bw_ls2, bw_notch, bw_peak.
* Fixed bug when setting default parameter values in bw_hs1_init().
* Fixed documentation to indicate correct default parameter values in bw_hs1,
bw_hs2, bw_ls1, bw_ls2, bw_notch, bw_peak.
* Limited actual prewarping frequency to prevent instability in bw_lp1.
* Fixed missing smoothing filter initialization in bw_noise_gate.
* Fixed missing forced coefficients' update in bw_noise_gate_reset_coeffs().
* Added bw_noise_gen_reset_coeffs(), bw_noise_gen_update_coeffs_ctrl(), and
bw_noise_gen_update_coeffs_audio().
* Improved and strengthened algorithm in bw_noise_gate.
* Now using backward Euler rather than impulse invariant method in
bw_one_pole.
* Added coeffs argument to bw_one_pole_state_is_valid().
* Changed implementation topology to use less memory in bw_osc_filt.
* Now antialiasing should work also with negative input increments.
* Clearly specified validity ranges for audio-rate signals in bw_osc_pulse,
bw_osc_saw, bw_osc_sin, bw_osc_tri.
* Added bw_osc_saw_set_sample_rate(), bw_osc_saw_reset_coeffs(),
bw_osc_saw_update_coeffs_ctrl(), and bw_osc_saw_update_coeffs_audio().
* Now using parabolic curves instead of trigonometric ones in bw_pan.
* Fixed smoothing coefficients update in bw_phase_gen_reset_coeffs().
* Removed internal limits on cutoff frequency in bw_phaser.
* Added bw_pink_filt_reset_coeffs(), bw_pink_filt_update_coeffs_ctrl(), and
bw_pink_filt_update_coeffs_audio().
* Fixed type of coefficient in <code>bw_pink_filt_process1()</code>.</li>
* Enforced minimum output value -600.f in bw_ppm.
* bw_ringmod renamed as bw_ring_mod.
* Fixed inverted-polarity modulation (for real this time) in bw_ring_mod.
* Changed default value for gain compensation to off in bw_satur.
* Added bw_slew_lim_process1_none().
* Fixed setting of default parameter values in bw_slew_lim_init().
* Fixed documentation of bw_slew_lim_update_coeffs_audio().
* Added bw_sr_reduce_set_sample_rate(), bw_sr_reduce_reset_coeffs(),
bw_sr_reduce_update_coeffs_ctrl(), and bw_sr_reduce_update_coeffs_audio().
* Removed useless computation when upsampling in bw_src.
* Clarified when the same buffers cannot be used for both input and output in
bw_src, bw_src_int.
* Fixed frequency response and improved speed in bw_src_int.
* Changed model to get positive polarity at the bandpass output in bw_svf.
* Limited actual prewarping frequency to prevent instability in bw_svf.
* Adjusted examples accordingly to changes.
0.6.0
-----
* Added support and examples for Android and iOS.

View File

@ -8,6 +8,7 @@ We wish to thank and give credit to:
- J. Dattorro, "Effect Design, Part 2: Delay-Line Modulation and Chorus", J. Audio Eng. Soc., vol. 45, no. 10, pp. 764-788, October 1997;
- V. Valimaki and A. Huovilainen, "Antialiasing Oscillators in Subtractive Synthesis", IEEE Signal Processing Magazine, vol. 24, no. 2, pp. 116-125, March 2007;
- M. E. O'Neill, "PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation", September 2014, available at <https://www.cs.hmc.edu/tr/hmc-cs-2014-0905.pdf>;
- J. D. Parker, V. Zavalishin, and E. Le Bivic, "Reducing the Aliasing of Nonlinear Waveshaping Using Continuous-Time Convolution", Proc. 19th Intl. Conf. Digital Audio Effects (DAFx-16), pp. 137-144, Brno, Czech Republic, September 2016.
- C. Wellons, "Finding the Best 64-bit Simulation PRNG", September 2017, available at <https://nullprogram.com/blog/2017/09/21/>;
- M. Holters and J.Parker, "A Combined Model for a Bucket Brigade Device and its Input and Output Filters", 21st Intl. Conf. Digital Audio Effects (DAFx-18), Aveiro, Portugal, September 2018;
- M. Holters and J. D. Parker, "A Combined Model for a Bucket Brigade Device and its Input and Output Filters", 21st Intl. Conf. Digital Audio Effects (DAFx-18), Aveiro, Portugal, September 2018;
- P. P. La Pastina and S. D'Angelo, "Optimal Integer Order Approximation of Fractional Order Filters", Proc. 24th Intl. Conf. Digital Audio Effects (DAFx20in21), pp. 89-96, Vienna, Austria, September 2021.

View File

@ -36,6 +36,7 @@
* value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_ap1_process()</code> and
* <code>bw_ap1_process_multi()</code> now use <code>size_t</code>
* to count samples and channels.</li>

View File

@ -36,6 +36,7 @@
* value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_ap2_process()</code> and
* <code>bw_ap2_process_multi()</code> now use <code>size_t</code>
* to count samples and channels.</li>

View File

@ -40,7 +40,7 @@
* <li>Version <strong>1.0.0</strong>:
* <ul>
* <li>Added initial value argument in
* <code>bw_chorus_reset_state()</code>.</li>
* <code>bw_comb_reset_state()</code>.</li>
* <li>Added <code>bw_comb_reset_state_multi()</code> and updated C++
* API in this regard.</li>
* <li>Now <code>bw_comb_reset_state()</code> returns the initial

View File

@ -31,6 +31,8 @@
* <ul>
* <li>Version <strong>1.0.0</strong>:
* <ul>
* <li>Added initial input values to
* <code>bw_comp_reset_state()</code>.</li>
* <li>Added <code>bw_comp_reset_state_multi()</code> and updated C++
* API in this regard.</li>
* <li>Now <code>bw_comp_reset_state()</code> returns the initial

View File

@ -3,11 +3,11 @@
*
* Copyright (C) 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redriveribute it and/or modify
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* Brickworks is driveributed in the hope that it will be useful,
* Brickworks is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
@ -36,6 +36,8 @@
* <ul>
* <li>Improved algorithm to be a bit more faithful to the
* original.</li>
* <li>Added initial input value to
* <code>bw_drive_reset_state()</code>.</li>
* <li>Added <code>bw_drive_reset_state_multi()</code> and updated C++
* API in this regard.</li>
* <li>Now <code>bw_drive_reset_state()</code> returns the initial

View File

@ -30,6 +30,8 @@
* <ul>
* <li>Version <strong>1.0.0</strong>:
* <ul>
* <li>Added initial input value to
* <code>bw_env_follow_reset_state()</code>.</li>
* <li>Added <code>bw_env_follow_reset_state_multi()</code> and updated
* C++ API in this regard.</li>
* <li>Now <code>bw_env_follow_reset_state()</code> returns the initial

View File

@ -44,6 +44,8 @@
* <ul>
* <li>Renamed <code>bw_env_gen_update_state_ctrl()</code> as
* <code>bw_env_gen_process_ctrl()</code>.</li>
* <li>Added initial gate value to
* <code>bw_env_gen_reset_state()</code>.</li>
* <li>Added <code>bw_env_gen_reset_state_multi()</code> and updated
* C++ API in this regard.</li>
* <li>Now <code>bw_env_gen_reset_state()</code> returns the initial

View File

@ -36,6 +36,8 @@
* <ul>
* <li>Improved algorithm to be a bit more faithful to the
* original.</li>
* <li>Added initial input value to
* <code>bw_fuzz_reset_state()</code>.</li>
* <li>Added <code>bw_fuzz_reset_state_multi()</code> and updated C++
* API in this regard.</li>
* <li>Now <code>bw_fuzz_reset_state()</code> returns the initial

View File

@ -35,6 +35,7 @@
* value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_hs2_process()</code> and
* <code>bw_hs2_process_multi()</code> now use <code>size_t</code>
* to count samples and channels.</li>

View File

@ -36,6 +36,7 @@
* value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_ls2_process()</code> and
* <code>bw_ls2_process_multi()</code> now use <code>size_t</code>
* to count samples and channels.</li>
@ -47,6 +48,8 @@
* <li>Removed usage of reserved identifiers.</li>
* <li>Added pragmas to silence bogus GCC uninitialized variable
* warnings.</li>
* <li>Fixed documentation to indicate correct default parameter
* values.</li>
* <li>Clearly specified parameter validity ranges.</li>
* <li>Added debugging code.</li>
* </ul>

View File

@ -29,6 +29,8 @@
* <ul>
* <li>Version <strong>1.0.0</strong>:
* <ul>
* <li>Added initial input values to
* <code>bw_noise_gate_reset_state()</code>.</li>
* <li>Added <code>bw_noise_gate_reset_state_multi()</code> and updated
* C++ API in this regard.</li>
* <li>Now <code>bw_noise_gate_reset_state()</code> returns the initial

View File

@ -36,6 +36,7 @@
* output value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_notch_process()</code> and
* <code>bw_notch_process_multi()</code> now use
* <code>size_t</code> to count samples and channels.</li>

View File

@ -49,8 +49,8 @@
* <li>Now using backward Euler rather than impulse invariant
* method.</li>
* <li>Clearly specified parameter validity ranges.</li>
* <li>Added more debugging code and added `coeffs` argument to
* <code>bw_one_pole_state_is_valid()</code>.</li>
* <li>Added more debugging code and added <code>coeffs</code> argument
* to <code>bw_one_pole_state_is_valid()</code>.</li>
* <li>Added pragmas to silence bogus GCC uninitialized variable
* warnings.</li>
* </ul>

View File

@ -51,6 +51,7 @@
* <li>Moved C++ code to C header.</li>
* <li>Added overloaded C++ <code>process()</code> function taking
* C-style arrays as arguments.</li>
* <li>Changed implementation topology to use less memory.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Added debugging code.</li>
* </ul>
@ -187,7 +188,7 @@ struct bw_osc_filt_state {
#endif
// States
float z1;
float z1;
};
static inline float bw_osc_filt_reset_state(

View File

@ -47,6 +47,8 @@
* <li>Moved C++ code to C header.</li>
* <li>Added overloaded C++ <code>process()</code> function taking
* C-style arrays as arguments.</li>
* <li>Now antialiasing should work also with negative input
* increments.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Clearly specified validity ranges for audio-rate signals.</li>
* <li>Added debugging code.</li>

View File

@ -50,6 +50,8 @@
* <li>Moved C++ code to C header.</li>
* <li>Added overloaded C++ <code>process()</code> function taking
* C-style arrays as arguments.</li>
* <li>Now antialiasing should work also with negative input
* increments.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Clearly specified validity ranges for audio-rate signals.</li>
* <li>Added debugging code.</li>

View File

@ -41,6 +41,7 @@
* <li>Added overloaded C++ <code>oscSinProcess()</code> function taking
* C-style arrays as arguments.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Clearly specified validity ranges for audio-rate signals.</li>
* <li>Added debugging code.</li>
* </ul>
* </li>

View File

@ -47,6 +47,8 @@
* <li>Moved C++ code to C header.</li>
* <li>Added overloaded C++ <code>process()</code> function taking
* C-style arrays as arguments.</li>
* <li>Now antialiasing should work also with negative input
* increments.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Clearly specified validity ranges for audio-rate signals.</li>
* <li>Added debugging code.</li>

View File

@ -43,6 +43,7 @@
* output value.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Added prewarp_at_cutoff and prewarp_freq parameters.</li>
* <li><code>bw_peak_process()</code> and
* <code>bw_peak_process_multi()</code> now use <code>size_t</code>
* to count samples and channels.</li>

View File

@ -36,7 +36,7 @@
* <li>Added <code>bw_phase_gen_reset_state_multi()</code> and updated
* C++ API in this regard.</li>
* <li>Now <code>bw_phase_gen_reset_state()</code> returns the initial
* output value.</li>
* output values.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li><code>bw_phase_gen_process()</code> and

View File

@ -61,6 +61,8 @@
* <li>Moved C++ code to C header.</li>
* <li>Added overloaded C++ <code>process()</code> function taking
* C-style arrays as arguments.</li>
* <li>Fixed type of coefficient in
* <code>bw_pink_filt_process1()</code>.</li>
* <li>Removed usage of reserved identifiers.</li>
* <li>Added debugging code.</li>
* </ul>
@ -175,6 +177,20 @@ static inline void bw_pink_filt_reset_state_multi(
* The corresponding initial output values are written into the `y_0` array,
* if not `NULL`.
*
* #### bw_pink_filt_update_coeffs_ctrl()
* ```>>> */
static inline void bw_pink_filt_update_coeffs_ctrl(
bw_pink_filt_coeffs * BW_RESTRICT coeffs);
/*! <<<```
* Triggers control-rate update of coefficients in `coeffs`.
*
* #### bw_pink_filt_update_coeffs_audio()
* ```>>> */
static inline void bw_pink_filt_update_coeffs_audio(
bw_pink_filt_coeffs * BW_RESTRICT coeffs);
/*! <<<```
* Triggers audio-rate update of coefficients in `coeffs`.
*
* #### bw_pink_filt_process1()
* ```>>> */
static inline float bw_pink_filt_process1(

View File

@ -37,12 +37,12 @@
* <ul>
* <li>Version <strong>1.0.0</strong>:
* <ul>
* <li>Added initial value argument in
* <li>Added initial value arguments in
* <code>bw_reverb_reset_state()</code>.</li>
* <li>Added <code>bw_reverb_reset_state_multi()</code> and updated C++
* API in this regard.</li>
* <li>Now <code>bw_reverb_reset_state()</code> returns the initial
* output value.</li>
* output values.</li>
* <li>Added overloaded C++ <code>reset()</code> functions taking
* arrays as arguments.</li>
* <li>Now using <code>size_t</code> instead of

View File

@ -27,8 +27,8 @@
*
* The multi-rate filtering approach was inspired by
*
* M. Holters and J.Parker, "A Combined Model for a Bucket Brigade Device and
* its Input and Output Filters", 21st Intl. Conf. Digital Audio Effects
* M. Holters and J. D. Parker, "A Combined Model for a Bucket Brigade Device
* and its Input and Output Filters", 21st Intl. Conf. Digital Audio Effects
* (DAFx-18), Aveiro, Portugal, September 2018.
* }}}
* changelog {{{
@ -111,7 +111,7 @@ static inline void bw_src_int_init(
* negative, then the sample rate of the output signal will be equal to the
* sample rate of the input signal divided by `-ratio`.
*
* `ratio` must not be `0`.
* `ratio` must not be in [`-1`, `1`].
*
* #### bw_src_int_reset_state()
* ```>>> */
@ -263,7 +263,7 @@ static inline void bw_src_int_init(
bw_src_int_coeffs * BW_RESTRICT coeffs,
int ratio) {
BW_ASSERT(coeffs != NULL);
BW_ASSERT(ratio != 0);
BW_ASSERT(ratio < -1 || ratio > 1);
coeffs->ratio = ratio;
// 4th-degree Butterworth with cutoff at ratio * Nyquist, using bilinear transform w/ prewarping
@ -459,7 +459,7 @@ static inline char bw_src_int_coeffs_is_valid(
return 0;
#endif
return coeffs->ratio != 0
return (coeffs->ratio < -1 || coeffs->ratio > 1)
&& bw_is_finite(coeffs->b0)
&& bw_is_finite(coeffs->ma1)
&& bw_is_finite(coeffs->ma2)