Allow customizing EQ filter types

Allows any EQ band to be set to any of Low Shelf, Peak, or High Shelf, instead of hardcoding the types per band.

Change-Id: I470ab916359092ba465e7b6331baed3bf11b2fc9
This commit is contained in:
Skye 2026-07-20 21:52:07 +09:00 • committed by Solomon Peachy
parent 1007216fc4
commit e764656ab7
6 changed files with 231 additions and 92 deletions

View file

@ -71,15 +71,22 @@ static void update_band_filter(int band, unsigned int fout)
functions */
typeof (filter_pk_coefs) *coef_gen = filter_pk_coefs;
/* Only first and last bands are not peaking filters */
if (band == 0)
coef_gen = filter_ls_coefs;
else if (band == EQ_NUM_BANDS-1)
coef_gen = filter_hs_coefs;
const struct eq_band_setting *setting = &settings[band];
struct dsp_filter *filter = &eq_data.filters[band];
switch (setting->type)
{
case EQ_FILTER_LOW_SHELF:
coef_gen = filter_ls_coefs;
break;
case EQ_FILTER_PEAK:
coef_gen = filter_pk_coefs;
break;
case EQ_FILTER_HIGH_SHELF:
coef_gen = filter_hs_coefs;
break;
}
coef_gen(fp_div(setting->cutoff, fout, 32), setting->q ?: 1,
setting->gain, filter);
}

View file

@ -23,8 +23,16 @@
/* => support from 3 to 32 bands */
#define EQ_NUM_BANDS 10
enum eq_filter_type
{
EQ_FILTER_LOW_SHELF = 0,
EQ_FILTER_PEAK,
EQ_FILTER_HIGH_SHELF,
};
struct eq_band_setting
{
enum eq_filter_type type;
int cutoff; /* Hz */
int q;
int gain; /* +/- dB */