Mute the i2s dac when sound output is inactive

This commit is contained in:
Jeff Epler 2025-03-28 09:18:00 -05:00
parent d41ccd1082
commit 41a8e0e9b6

View file

@ -739,7 +739,23 @@ static bool audio_poll() {
return true;
}
static bool mute_state = false;
static void set_mute_state(bool new_state) {
if(mute_state == new_state) return;
mute_state = new_state;
setPage(1);
if(mute_state) {
modifyRegister(0x28, 0x04, 0x04); // HP Left not muted
modifyRegister(0x29, 0x04, 0x04); // HP Right not muted
} else {
modifyRegister(0x28, 0x04, 0x0); // HP Left muted
modifyRegister(0x29, 0x04, 0x0); // HP Right muted
}
}
void umac_audio_cfg(int volume, int sndres) {
volscale = sndres ? 0 : 65536 * volume / 7;
set_mute_state(volscale != 0);
}
#endif