fix(audio): ES8311 BOTH complementary open + audio-stream close ref-count + mic unmute

- es8311 driver open() now allows OUTPUT->INPUT complementary (promotes to BOTH) when same native rate 44100
- audio-stream close_stream() ref-counts shared BOTH codec (don't close if other direction still open)
- MCP recordVoice + VoiceRecorder app explicitly unmute and set 100% gain

Fixes mic input not working - was returning ERROR_RESOURCE when output already open
This commit is contained in:
Adolfo Reyna
2026-07-18 19:55:47 -04:00
parent 15aad3f585
commit c7dc66e04b
3 changed files with 38 additions and 8 deletions
+3
View File
@@ -796,6 +796,9 @@ bool recordVoice(int durationSec, const std::string& filename, size_t& recordedB
set_error(error, "Failed to open audio input stream");
goto done;
}
audio_stream_set_mute(state.audioStreamDevice, AUDIO_CODEC_DIR_INPUT, false);
audio_stream_set_volume(state.audioStreamDevice, AUDIO_CODEC_DIR_INPUT, 100.0f);
LOG_I(TAG, "Mic unmuted gain 100%% for %s", filename.c_str());
} else {
if (!configure_i2s(state, AUDIO_SAMPLE_RATE, 1, error)) {
goto done;