Skip to content

Commit

Permalink
Merge pull request #439 from digidocs/eq_update_fix2
Browse files Browse the repository at this point in the history
Fix for ESP32 equalizer settings don't update when expected
  • Loading branch information
philippe44 authored Sep 11, 2024
2 parents 4068e07 + e21e2cf commit 7f0ae69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 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,9 +162,6 @@ void equalizer_set_gain(int8_t *gain) {
config[n-1] = '\0';
config_set_value(NVS_TYPE_STR, "equalizer", config);

// update only if something changed
if (!memcmp(equalizer.gain, gain, EQ_BANDS)) equalizer.update = true;

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

0 comments on commit 7f0ae69

Please sign in to comment.