mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +03:00
Equalizer: check if requested gain has changed before updating
This commit is contained in:
@@ -148,18 +148,28 @@ void equalizer_set_volume(unsigned left, unsigned right) {
|
||||
*/
|
||||
void equalizer_set_gain(int8_t *gain) {
|
||||
#if BYTES_PER_FRAME == 4
|
||||
static uint8_t last_gain[EQ_BANDS] = { };
|
||||
bool eq_update = false;
|
||||
|
||||
char config[EQ_BANDS * 4 + 1] = { };
|
||||
int n = 0;
|
||||
|
||||
for (int i = 0; i < EQ_BANDS; i++) {
|
||||
equalizer.gain[i] = gain[i];
|
||||
n += sprintf(config + n, "%d,", gain[i]);
|
||||
|
||||
if (gain[i] != last_gain[i])
|
||||
{
|
||||
eq_update = true;
|
||||
}
|
||||
last_gain[i] = gain[i];
|
||||
}
|
||||
|
||||
config[n-1] = '\0';
|
||||
config_set_value(NVS_TYPE_STR, "equalizer", config);
|
||||
|
||||
equalizer.update = true;
|
||||
//"or" in this value in case equalizer.update is set for another reason
|
||||
equalizer.update |= eq_update;
|
||||
|
||||
LOG_INFO("equalizer gain %s", config);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user