Skip to content

Commit

Permalink
Equalizer: change gain to int8 and memcmp-based update check
Browse files Browse the repository at this point in the history
  • Loading branch information
digidocs committed Sep 4, 2024
1 parent 57cd009 commit e21e2cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/squeezelite/equalizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static EXT_RAM_ATTR struct {
void *handle;
float loudness, volume;
uint32_t samplerate;
float gain[EQ_BANDS], loudness_gain[EQ_BANDS];
int8_t gain[EQ_BANDS];
float loudness_gain[EQ_BANDS];
bool update;
} equalizer;

Expand Down Expand Up @@ -151,6 +152,8 @@ void equalizer_set_gain(int8_t *gain) {
char config[EQ_BANDS * 4 + 1] = { };
int n = 0;

if (memcmp(equalizer.gain, gain, EQ_BANDS) != 0) equalizer.update = true;

for (int i = 0; i < EQ_BANDS; i++) {
equalizer.gain[i] = gain[i];
n += sprintf(config + n, "%d,", gain[i]);
Expand All @@ -159,8 +162,6 @@ void equalizer_set_gain(int8_t *gain) {
config[n-1] = '\0';
config_set_value(NVS_TYPE_STR, "equalizer", config);

equalizer.update = true;

LOG_INFO("equalizer gain %s", config);
#else
LOG_INFO("no equalizer with 32 bits samples");
Expand Down

0 comments on commit e21e2cf

Please sign in to comment.