fixed unused parameter warnings

This commit is contained in:
Stefano D'Angelo 2023-04-02 21:54:17 +02:00
parent 8f4e50f0a7
commit 8fe8a6f995
20 changed files with 131 additions and 25 deletions

1
TODO
View File

@ -17,7 +17,6 @@ code:
* common smoothing policy (as control rate as possible?) - smoothing control?
* avoid "force" in coeffs update by using inline functions?
* should rather use backward Euler in bw_onepole?
* treat unused variable/function warnings
* csch for bw_peak bandwidth -> Q, inv sqrt ls2 hs2
* sample rate-constant coeffs? (pan case)
* pan process with no out: should just reset coeffs?

View File

@ -6,7 +6,9 @@ CFLAGS := \
--target=wasm32 \
-flto \
-fvisibility=hidden \
-Ofast
-Ofast \
-Wall \
-Wunused-parameter
LDFLAGS := \
-Wl,--allow-undefined \
-Wl,--no-entry \

View File

@ -115,6 +115,7 @@ float *wrapper_get_ins(wrapper w) {
#if NUM_BUSES_IN != 0
return w->ins;
#else
(void)w;
return NULL;
#endif
}
@ -123,6 +124,7 @@ float *wrapper_get_outs(wrapper w) {
#if NUM_BUSES_OUT != 0
return w->outs;
#else
(void)w;
return NULL;
#endif
}
@ -131,6 +133,7 @@ float *wrapper_get_param_values(wrapper w) {
#if NUM_PARAMETERS != 0
return w->param_values;
#else
(void)w;
return NULL;
#endif
}
@ -158,29 +161,46 @@ void wrapper_set_parameter(wrapper w, int index, float value) {
#if NUM_PARAMETERS != 0
P_SET_PARAMETER(&w->instance, index, value);
w->param_values[index] = value;
#else
(void)w;
(void)index;
(void)value;
#endif
}
void wrapper_note_on(wrapper w, int note, int velocity) {
#ifdef P_NOTE_ON
P_NOTE_ON(&w->instance, note, velocity);
#else
(void)w;
(void)note;
(void)velocity;
#endif
}
void wrapper_note_off(wrapper w, int note) {
#ifdef P_NOTE_OFF
P_NOTE_OFF(&w->instance, note);
#else
(void)w;
(void)note;
#endif
}
void wrapper_pitch_bend(wrapper w, int bend) {
#ifdef P_PITCH_BEND
P_PITCH_BEND(&w->instance, bend);
#else
(void)w;
(void)bend;
#endif
}
void wrapper_mod_wheel(wrapper w, int wheel) {
#ifdef P_MOD_WHEEL
P_MOD_WHEEL(&w->instance, wheel);
#else
(void)w;
(void)wheel;
#endif
}

View File

@ -26,6 +26,8 @@ void bw_example_fx_bitcrush_init(bw_example_fx_bitcrush *instance) {
}
void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush *instance, float sample_rate) {
(void)instance;
(void)sample_rate;
}
void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush *instance) {

View File

@ -132,6 +132,8 @@ void bw_example_synth_mono_process(bw_example_synth_mono *instance, const float*
// it's all good as long as hosts gives us buffers whose length is a multiple of 32,
// otherwise it's probably still ok but a bit "swingy"
(void)x;
bw_env_gen_set_gate(&instance->vcf_env_gen_coeffs, instance->gate);
bw_env_gen_set_gate(&instance->vca_env_gen_coeffs, instance->gate);
@ -334,14 +336,14 @@ void bw_example_synth_mono_note_on(bw_example_synth_mono *instance, char note, c
if (velocity == 0)
bw_example_synth_mono_note_off(instance, note);
else {
instance->notes_pressed[note] = 1;
instance->notes_pressed[(int)note] = 1;
update_note_gate(instance);
}
}
void bw_example_synth_mono_note_off(bw_example_synth_mono *instance, char note) {
if (instance->notes_pressed[note]) {
instance->notes_pressed[note] = 0;
if (instance->notes_pressed[(int)note]) {
instance->notes_pressed[(int)note] = 0;
update_note_gate(instance);
}
}

View File

@ -60,6 +60,8 @@ void bw_example_synth_simple_reset(bw_example_synth_simple *instance) {
}
void bw_example_synth_simple_process(bw_example_synth_simple *instance, const float** x, float** y, int n_samples) {
(void)x;
char gate = instance->note >= 0 ? 1 : 0;
bw_env_gen_set_gate(&instance->env_gen_coeffs, gate);
if (instance->note >= 0)

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math }}}
* description {{{
* Bit depth reducer.
@ -31,6 +31,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>First release.</li>
@ -141,6 +146,7 @@ static inline void bw_bd_reduce_update_coeffs_ctrl(bw_bd_reduce_coeffs *BW_RESTR
}
static inline void bw_bd_reduce_update_coeffs_audio(bw_bd_reduce_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline float bw_bd_reduce_process1(const bw_bd_reduce_coeffs *BW_RESTRICT coeffs, float x) {

View File

@ -173,6 +173,7 @@ static inline void bw_delay_mem_set(bw_delay_state *BW_RESTRICT state, void *mem
}
static inline void bw_delay_reset_coeffs(bw_delay_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_delay_reset_state(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state) {
@ -193,9 +194,11 @@ static void bw_delay_write(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_s
}
static inline void bw_delay_update_coeffs_ctrl(bw_delay_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_delay_update_coeffs_audio(bw_delay_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline float bw_delay_process1(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state, float x) {

View File

@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_one_pole bw_math }}}
* description {{{
* Linear ADSR envelope generator.
@ -40,6 +40,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>Avoid a warning related to a potentially uninitialized
@ -277,6 +282,7 @@ static inline void bw_env_gen_reset_coeffs(bw_env_gen_coeffs *BW_RESTRICT coeffs
}
static inline void bw_env_gen_reset_state(const bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state) {
(void)coeffs;
state->phase = bw_env_gen_phase_off;
state->y_z1 = 0.f;
}
@ -294,6 +300,7 @@ static inline void bw_env_gen_update_coeffs_ctrl(bw_env_gen_coeffs *BW_RESTRICT
}
static inline void bw_env_gen_update_coeffs_audio(bw_env_gen_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_env_gen_update_state_ctrl(const bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math bw_one_pole }}}
* description {{{
* First-order lowpass filter (6 dB/oct) with unitary DC gain.
@ -30,6 +30,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>First release.</li>
@ -216,11 +221,13 @@ static inline void bw_lp1_reset_coeffs(bw_lp1_coeffs *BW_RESTRICT coeffs) {
}
static inline void bw_lp1_reset_state(const bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_state *BW_RESTRICT state) {
(void)coeffs;
state->y_z1 = 0.f;
state->X_z1 = 0.f;
}
static inline void bw_lp1_update_coeffs_ctrl(bw_lp1_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_lp1_update_coeffs_audio(bw_lp1_coeffs *BW_RESTRICT coeffs) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.2.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math }}}
* description {{{
* One-pole (6 dB/oct) lowpass filter with unitary DC gain, separate attack
@ -30,6 +30,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.2.0</strong>:
* <ul>
* <li>Refactored API.</li>
@ -312,6 +317,7 @@ static inline void bw_one_pole_reset_coeffs(bw_one_pole_coeffs *BW_RESTRICT coef
}
static inline void bw_one_pole_reset_state(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float y_z1) {
(void)coeffs;
state->y_z1 = y_z1;
}
@ -328,6 +334,7 @@ static inline void bw_one_pole_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RESTRIC
}
static inline void bw_one_pole_update_coeffs_audio(bw_one_pole_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.2.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_one_pole bw_math }}}
* description {{{
* Pulse oscillator waveshaper with variable pulse width (actually, duty
@ -31,6 +31,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.2.0</strong>:
* <ul>
* <li>Refactored API.</li>
@ -170,6 +175,7 @@ static inline void bw_osc_pulse_reset_coeffs(bw_osc_pulse_coeffs *BW_RESTRICT co
}
static inline void bw_osc_pulse_update_coeffs_ctrl(bw_osc_pulse_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_osc_pulse_update_coeffs_audio(bw_osc_pulse_coeffs *BW_RESTRICT coeffs) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.2.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math }}}
* description {{{
* Sawtooth oscillator waveshaper with PolyBLEP antialiasing.
@ -30,6 +30,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.2.0</strong>:
* <ul>
* <li>Refactored API.</li>
@ -118,6 +123,7 @@ static inline void bw_osc_saw_init(bw_osc_saw_coeffs *BW_RESTRICT coeffs) {
}
static inline float bw_osc_saw_process1(const bw_osc_saw_coeffs *BW_RESTRICT coeffs, float x) {
(void)coeffs;
return x + x - 1.f;
}
@ -129,6 +135,7 @@ static inline float _bw_osc_saw_blep_diff(float x) {
}
static inline float bw_osc_saw_process1_antialias(const bw_osc_saw_coeffs *BW_RESTRICT coeffs, float x, float x_phase_inc) {
(void)coeffs;
const float s_1_m_phase = 1.f - x;
float v = x - s_1_m_phase;
if (x_phase_inc != 0.f) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.2.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_one_pole bw_math }}}
* description {{{
* Triangle oscillator waveshaper with variable slope (increasing time over
@ -31,6 +31,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.2.0</strong>:
* <ul>
* <li>Refactored API.</li>
@ -170,6 +175,7 @@ static inline void bw_osc_tri_reset_coeffs(bw_osc_tri_coeffs *BW_RESTRICT coeffs
}
static inline void bw_osc_tri_update_coeffs_ctrl(bw_osc_tri_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_osc_tri_update_coeffs_audio(bw_osc_tri_coeffs *BW_RESTRICT coeffs) {

View File

@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math bw_one_pole }}}
* description {{{
* Phase generator with portamento and exponential frequency modulation.
@ -29,6 +29,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>Added `BW_RESTRICT` to `bw_phase_gen_process1\*()`.</li>
@ -202,6 +207,7 @@ static inline void bw_phase_gen_reset_coeffs(bw_phase_gen_coeffs *BW_RESTRICT co
}
static inline void bw_phase_gen_reset_state(const bw_phase_gen_coeffs *BW_RESTRICT coeffs, bw_phase_gen_state *BW_RESTRICT state, float phase_0) {
(void)coeffs;
state->phase = phase_0;
}

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common }}}
* description {{{
* Pinking filter.
@ -34,6 +34,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>Fixed <code>bw_pink_filt_set_sample_rate_scaling()</code>
@ -168,6 +173,7 @@ static inline void bw_pink_filt_set_sample_rate(bw_pink_filt_coeffs *BW_RESTRICT
}
static inline void bw_pink_filt_reset_state(const bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state *BW_RESTRICT state) {
(void)coeffs;
state->s1_z1 = 0.f;
state->s2_z1 = 0.f;
state->s3_z1 = 0.f;
@ -175,6 +181,7 @@ static inline void bw_pink_filt_reset_state(const bw_pink_filt_coeffs *BW_RESTRI
}
static inline float bw_pink_filt_process1(const bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state *BW_RESTRICT state, float x) {
(void)coeffs;
const float s1 = 0.320696754235142f * x + state->s1_z1;
state->s1_z1 = 0.999760145116749f * s1 - 0.3204568993518913f * x;
const float s2 = 0.2870206617007935f * s1 + state->s2_z1;
@ -187,6 +194,7 @@ static inline float bw_pink_filt_process1(const bw_pink_filt_coeffs *BW_RESTRICT
}
static inline float bw_pink_filt_process1_scaling(const bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state *BW_RESTRICT state, float x) {
(void)coeffs;
return coeffs->scaling_k * bw_pink_filt_process1(coeffs, state, x);
}

View File

@ -142,6 +142,7 @@ static inline void bw_ringmod_reset_coeffs(bw_ringmod_coeffs *BW_RESTRICT coeffs
}
static inline void bw_ringmod_update_coeffs_ctrl(bw_ringmod_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_ringmod_update_coeffs_audio(bw_ringmod_coeffs *BW_RESTRICT coeffs) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.2.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_one_pole bw_math }}}
* description {{{
* Antialiased tanh-based saturation with parametric bias and gain
@ -38,6 +38,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.2.0</strong>:
* <ul>
* <li>First release.</li>
@ -221,11 +226,13 @@ static inline void bw_satur_reset_coeffs(bw_satur_coeffs *BW_RESTRICT coeffs) {
}
static inline void bw_satur_reset_state(const bw_satur_coeffs *BW_RESTRICT coeffs, bw_satur_state *BW_RESTRICT state) {
(void)coeffs;
state->F_z1 = 0.f;
state->x_z1 = 0.f;
}
static inline void bw_satur_update_coeffs_ctrl(bw_satur_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_satur_update_coeffs_audio(bw_satur_coeffs *BW_RESTRICT coeffs) {

View File

@ -1,7 +1,7 @@
/*
* Brickworks
*
* Copyright (C) 2022 Orastron Srl unipersonale
* Copyright (C) 2022, 2023 Orastron Srl unipersonale
*
* Brickworks is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
/*!
* module_type {{{ dsp }}}
* version {{{ 0.3.0 }}}
* version {{{ 0.4.0 }}}
* requires {{{ bw_config bw_common bw_math }}}
* description {{{
* Sample rate reducer.
@ -31,6 +31,11 @@
* }}}
* changelog {{{
* <ul>
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
* <ul>
* <li>First release.</li>
@ -122,6 +127,7 @@ static inline void bw_sr_reduce_init(bw_sr_reduce_coeffs *BW_RESTRICT coeffs) {
}
static inline void bw_sr_reduce_reset_state(const bw_sr_reduce_coeffs *BW_RESTRICT coeffs, bw_sr_reduce_state *BW_RESTRICT state) {
(void)coeffs;
state->phase = 1.f;
}

View File

@ -31,6 +31,7 @@
* <li>Version <strong>0.4.0</strong>:
* <ul>
* <li>Added initial input value to `bw_svf_reset_state()`.</li>
* <li>Fixed unused parameter warnings.</li>
* </ul>
* </li>
* <li>Version <strong>0.3.0</strong>:
@ -264,6 +265,7 @@ static inline void bw_svf_reset_state(const bw_svf_coeffs *BW_RESTRICT coeffs, b
}
static inline void bw_svf_update_coeffs_ctrl(bw_svf_coeffs *BW_RESTRICT coeffs) {
(void)coeffs;
}
static inline void bw_svf_update_coeffs_audio(bw_svf_coeffs *BW_RESTRICT coeffs) {