From 5f8a3e171c4ed57a1af11656e1b85409a93331b2 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Sat, 1 Aug 2026 00:22:57 +0200 Subject: [PATCH] =?UTF-8?q?feat(sim):=20a=20speaker-sink=20gate=20on=20the?= =?UTF-8?q?=20shim=20=E2=80=94=20audio=20out=20follows=20the=20part?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/store/useSimulatorStore.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/store/useSimulatorStore.ts b/frontend/src/store/useSimulatorStore.ts index 06017322..9c19a416 100644 --- a/frontend/src/store/useSimulatorStore.ts +++ b/frontend/src/store/useSimulatorStore.ts @@ -427,6 +427,17 @@ class Esp32BridgeShim { .setSpeakerMonitor?.(cb); } + /** + * Gate the board's audio OUTPUT at the sink end: muted, the guest keeps + * clocking I2S TX samples out exactly like real hardware with nothing + * plugged in, but the host speakers stay silent. The part that IS the + * speaker (seated or wired) opens the gate while it is connected and + * closes it when it is lifted off. No-op on bridges without an audio path. + */ + setSpeakerMuted(muted: boolean): void { + (this.bridge as { setSpeakerMuted?: (m: boolean) => void }).setSpeakerMuted?.(muted); + } + /** Remove a previously-registered virtual device. */ removeI2CDevice(addr: number, _bus: 0 | 1 = 0): void { this.i2cBusInstance.removeDevice(addr);