fix doc bw_svf, bw_vol, bw_wah

This commit is contained in:
Stefano D'Angelo 2022-12-04 18:57:49 +01:00
parent 3518d1bbcf
commit 6ef98b1382
4 changed files with 107 additions and 66 deletions

1
TODO
View File

@ -13,6 +13,7 @@ code:
* float in [-1,1] for velocity, pitch bend, mod wheel
* should clip slope in triangle?
* fix vst3 mapped values (visible in Ableton Live) and short names
* bw_vol set volume in dB?
build system:
* make makefiles handle paths with spaces etc

View File

@ -55,69 +55,85 @@ extern "C" {
* ```>>> */
typedef struct _bw_svf_coeffs bw_svf_coeffs;
/*! <<<```
* Coefficients.
* Coefficients and related.
*
* ### bw_svf_state
* ```>>> */
typedef struct _bw_svf_state bw_svf_state;
/*! <<<```
* State.
* Internal state and related.
*
* #### bw_svf_init()
* ```>>> */
static inline void bw_svf_init(bw_svf_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Initializes `coeffs`.
* Initializes input parameter values in `coeffs`.
*
* #### bw_svf_set_sample_rate()
* ```>>> */
static inline void bw_svf_set_sample_rate(bw_svf_coeffs *BW_RESTRICT coeffs, float sample_rate);
/*! <<<```
* Sets the `sample_rate` (Hz) value for the given `coeffs`.
* Sets the `sample_rate` (Hz) value in `coeffs`.
*
* #### bw_svf_reset_coeffs()
* ```>>> */
static inline void bw_svf_reset_coeffs(bw_svf_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Resets coefficients in `coeffs` to assume their target values.
*
* #### bw_svf_reset_state()
* ```>>> */
static inline void bw_svf_reset_state(const bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state *BW_RESTRICT state);
/*! <<<```
* Resets the given `state` to the initial state using the given `coeffs`.
* >>> */
static inline void bw_svf_reset_coeffs(bw_svf_coeffs *BW_RESTRICT coeffs);
* Resets the given `state` to its initial values using the given `coeffs`.
*
* #### bw_svf_update_coeffs_ctrl()
* ```>>> */
static inline void bw_svf_update_coeffs_ctrl(bw_svf_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers control-rate update of coefficients in `coeffs`.
*
* #### bw_svf_update_coeffs_audio()
* ```>>> */
static inline void bw_svf_update_coeffs_audio(bw_svf_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers audio-rate update of coefficients in `coeffs`.
*
* #### bw_svf_process1()
* ```>>> */
static inline void bw_svf_process1(const bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state *BW_RESTRICT state, float x, float *y_lp, float *y_bp, float *y_hp);
/*! ...
/*! <<<```
* Processes one input sample `x` using `coeffs`, while using and updating
* `state`. The lowpass, bandpass, and highpass output samples are put into
* `y_lp`, `y_bp`, and `y_hp` respectively.
*
* #### bw_svf_process()
* ```>>> */
static inline void bw_svf_process(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state *BW_RESTRICT state, const float *x, float *y_lp, float *y_bp, float *y_hp, int n_samples);
/*! <<<```
* Lets the given `instance` process `n_samples` samples from the input
* buffer `x` and fills the corresponding `n_samples` samples in the output
* buffers `y_lp` (lowpass), `y_bp` (bandpass), and `y_hp` (highpass), if
* they are not `NULL`.
* >>> */
/*! ...
* Processes the first `n_samples` of the input buffer `x` and fills the
* first `n_samples` of the output buffers `y_lp` (lowpass), `y_bp`
* (bandpass), and `y_hp` (highpass), if they are not `NULL`, while using and
* updating both `coeffs` and `state` (control and audio rate).
*
* #### bw_svf_set_cutoff()
* ```>>> */
static inline void bw_svf_set_cutoff(bw_svf_coeffs *BW_RESTRICT coeffs, float value);
/*! <<<```
* Sets the cutoff frequency to the given `value` (Hz) for the given
* `instance`.
* Sets the cutoff frequency to the given `value` (Hz) in `coeffs`.
*
* `value` must be positive and smaller than the Nyquist frequency (half the
* sample rate).
*
* Default value: `1e3f`.
* >>> */
/*! ...
*
* #### bw_svf_set_Q()
* ```>>> */
static inline void bw_svf_set_Q(bw_svf_coeffs *BW_RESTRICT coeffs, float value);
/*! <<<```
* Sets the quality factor to the given `value` (Hz) for the given
* `instance`.
* Sets the quality factor to the given `value` (Hz) in `coeffs`.
*
* `value` must be equal or bigger than `0.5f`.
*
* Default value: `0.5f`.
* }}} */

View File

@ -22,7 +22,7 @@
* version {{{ 0.2.0 }}}
* requires {{{ bw_config bw_common bw_math bw_one_pole }}}
* description {{{
* Volume control for an arbitrary number of channels.
* Volume control.
* }}}
* changelog {{{
* <ul>
@ -54,49 +54,59 @@ extern "C" {
* ```>>> */
typedef struct _bw_vol_coeffs bw_vol_coeffs;
/*! <<<```
* Coefficients.
* Coefficients and related.
*
* #### bw_vol_init()
* ```>>> */
static inline void bw_vol_init(bw_vol_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Initializes `coeffs`.
* Initializes input parameter values in `coeffs`.
*
* #### bw_vol_set_sample_rate()
* ```>>> */
static inline void bw_vol_set_sample_rate(bw_vol_coeffs *BW_RESTRICT coeffs, float sample_rate);
/*! <<<```
* Sets the `sample_rate` (Hz) value for the given `coeffs`.
* Sets the `sample_rate` (Hz) value in `coeffs`.
*
* >>> */
* #### bw_vol_reset_coeffs()
* ```>>> */
static inline void bw_vol_reset_coeffs(bw_vol_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Resets coefficients in `coeffs` to assume their target values.
*
* #### bw_vol_update_coeffs_ctrl()
* ```>>> */
static inline void bw_vol_update_coeffs_ctrl(bw_vol_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers control-rate update of coefficients in `coeffs`.
*
* #### bw_vol_update_coeffs_audio()
* ```>>> */
static inline void bw_vol_update_coeffs_audio(bw_vol_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers audio-rate update of coefficients in `coeffs`.
*
* #### bw_vol_process1()
* ```>>> */
static inline float bw_vol_process1(const bw_vol_coeffs *BW_RESTRICT coeffs, float x);
/*! ...
/*! <<<```
* Processes one input sample `x` using `coeffs` and returns the
* corresponding output sample.
*
* #### bw_vol_process()
* ```>>> */
static inline void bw_vol_process(bw_vol_coeffs *BW_RESTRICT coeffs, const float *x, float *y, int n_samples);
/*! <<<```
* Lets the given `instance` process `n_samples` samples from each of the
* `n_channels` input buffers and fills the corresponding `n_samples` samples
* in each of the `n_channels` output buffers.
* Processes the first `n_samples` of the input buffer `x` and fills the
* first `n_samples` of the output buffer `y`, while using and updating
* `coeffs` (control and audio rate).
*
* `x` is an array of `n_channels` input buffers and similarly `y` is an
* array of `n_channels` output buffers.
* >>> */
/*! ...
* #### bw_vol_set_volume()
* ```>>> */
static inline void bw_vol_set_volume(bw_vol_coeffs *BW_RESTRICT coeffs, float value);
/*! <<<```
* Sets the volume parameter to the given `value` (range [`0.f`, `1.f`]) for
* the given `instance`.
* Sets the volume parameter to the given `value` (range [`0.f`, `1.f`]) in
* `coeffs`.
*
* This parameter is not linearly mapped, but the range extremes correspond
* to silence (gain = `0.f`) and bypass (gain = `1.f`).

View File

@ -51,57 +51,71 @@ extern "C" {
* ```>>> */
typedef struct _bw_wah_coeffs bw_wah_coeffs;
/*! <<<```
* Coefficients.
* Coefficients and related.
*
* ### bw_svf_state
* ```>>> */
typedef struct _bw_wah_state bw_wah_state;
/*! <<<```
* State.
* Internal state and related.
*
* #### bw_wah_init()
* ```>>> */
static inline void bw_wah_init(bw_wah_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Initializes `coeffs`.
* Initializes input parameter values in `coeffs`.
*
* #### bw_wah_set_sample_rate()
* ```>>> */
static inline void bw_wah_set_sample_rate(bw_wah_coeffs *BW_RESTRICT coeffs, float sample_rate);
/*! <<<```
* Sets the `sample_rate` (Hz) value for the given `coeffs`.
* Sets the `sample_rate` (Hz) value in `coeffs`.
*
* #### bw_wah_reset_state()
* ```>>> */
static inline void bw_wah_reset_coeffs(bw_wah_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Resets coefficients in `coeffs` to assume their target values.
*
* #### bw_wah_reset_state()
* ```>>> */
static inline void bw_wah_reset_state(const bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT state);
/*! <<<```
* Resets the given `state` to the initial state using the given `coeffs`.
* >>> */
static inline void bw_wah_reset_coeffs(bw_wah_coeffs *BW_RESTRICT coeffs);
* Resets the given `state` to its initial values using the given `coeffs`.
*
* #### bw_wah_update_coeffs_ctrl()
* ```>>> */
static inline void bw_wah_update_coeffs_ctrl(bw_wah_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers control-rate update of coefficients in `coeffs`.
*
* #### bw_wah_update_coeffs_audio()
* ```>>> */
static inline void bw_wah_update_coeffs_audio(bw_wah_coeffs *BW_RESTRICT coeffs);
/*! <<<```
* Triggers audio-rate update of coefficients in `coeffs`.
*
* #### bw_wah_process1()
* ```>>> */
static inline float bw_wah_process1(const bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT state, float x);
/*! ...
* #### bw_wah_process()
/*! <<<```
* Processes one input sample `x` using `coeffs`, while using and updating
* `state`. Returns the corresponding output sample.
*
* #### bw_env_follow_process()
* ```>>> */
static inline void bw_wah_process(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT state, const float *x, float *y, int n_samples);
/*! <<<```
* Lets the given `instance` process `n_samples` samples from the input
* buffer `x` and fills the corresponding `n_samples` samples in the output
* buffer `y`.
* >>> */
/*! ...
* Processes the first `n_samples` of the input buffer `x` and fills the
* first `n_samples` of the output buffer `y`, while using and updating both
* `coeffs` and `state` (control and audio rate).
*
* #### bw_wah_set_wah()
* ```>>> */
static inline void bw_wah_set_wah(bw_wah_coeffs *BW_RESTRICT coeffs, float value);
/*! <<<```
* Sets the wah pedal position to the given `value` in [`0.f` (low cutoff),
* `1.f` (high cutoff)].
* `1.f` (high cutoff)] in `coeffs`.
*
* Default value: `0.5f`.
* }}} */