Skip to content

feat: mute system audio while recording - #212

Open
Mr-Sunglasses wants to merge 1 commit into
VocaHQ:mainfrom
Mr-Sunglasses:feat/mute-system-audio-while-recording
Open

feat: mute system audio while recording#212
Mr-Sunglasses wants to merge 1 commit into
VocaHQ:mainfrom
Mr-Sunglasses:feat/mute-system-audio-while-recording

Conversation

@Mr-Sunglasses

@Mr-Sunglasses Mr-Sunglasses commented Aug 11, 2026

Copy link
Copy Markdown
Member

closes: #167

Summary

  • Add an opt-in Audio settings toggle to mute system audio during recording.
  • Snapshot and restore the default output device mute state through Core Audio.
  • Restore audio on stop, cancel, force recovery, startup failure, and audio-device interruption.
  • Add mock-backed recording lifecycle tests and documentation.

Validation

  • swift build
  • swift test: 308 tests passed, 3 skipped, 0 failures
  • git diff --check

@github-actions github-actions Bot added app bug Something isn't working ci docs and removed ci labels Aug 11, 2026
@jatinkrmalik jatinkrmalik added this to the v0.8.0 milestone Aug 12, 2026
@Mr-Sunglasses
Mr-Sunglasses force-pushed the feat/mute-system-audio-while-recording branch from 17c7dc6 to 2790518 Compare August 12, 2026 05:48

@jatinkrmalik jatinkrmalik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mr-Sunglasses this can leave the Mac muted. I wouldn't ship it as written.

Production AppState is a static singleton, so SystemAudioMuteManager.deinit will not run on Quit. The menu bar and Settings quit with NSApplication.shared.terminate(nil) without restoring output. Force-quit and crashes skip Swift deinit entirely. The snapshot is RAM-only, so the next launch cannot repair a leftover mute.

restoreSystemAudio() also sets muteSnapshot = nil before setMute. If Core Audio fails (Bluetooth gone, sleep, recycled AudioDeviceID), you log a warning and throw away the only record that VocaMac muted the machine.

handleAutoPauseEntered() stops the engine and returns to idle without restore. Mute runs after startAudioEngine(), so on AirPods the HFP settle window (up to 3s) leaks system audio into the mic, then the start chime plays while muted.

Please persist {device UID, wasMuted} before muting, restore on willTerminate and on next launch, keep the snapshot until setMute succeeds, restore in the auto-pause path, and mute before starting the engine.

Also drop closes #167. That issue is Spotify Connect on an external speaker. Muting the Mac default output does not touch it.

Tests currently only assert call counts on MockSystemAudioMuter. The real snapshot/restore machine has zero tests.

@Mr-Sunglasses Mr-Sunglasses removed this from the v0.8.0 milestone Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app bug Something isn't working docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Spotify Pause & Resume

2 participants