fix(voice): skip sounddevice on macOS to avoid TCC media-library prompt

On macOS, initializing PortAudio/CoreAudio via sounddevice triggers a
kTCCServiceMediaLibrary permission dialog even when no media-library
access is needed. afplay already handles WAV (and every other format)
natively, so route macOS playback straight to it and keep sounddevice
for other platforms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Simon 2026-07-11 13:15:43 +02:00 committed by Teknium
parent 0a5c5519fc
commit 0179ff9738

View file

@ -1306,8 +1306,10 @@ def play_audio_file(file_path: str) -> bool:
logger.warning("Audio file not found: %s", file_path)
return False
# Try sounddevice for WAV files
if file_path.endswith(".wav"):
# On macOS, skip sounddevice entirely — PortAudio/CoreAudio init triggers
# a kTCCServiceMediaLibrary permission prompt even though we don't need it.
# afplay handles all formats natively without touching the media stack.
if file_path.endswith(".wav") and platform.system() != "Darwin":
try:
sd, np = _import_audio()
with wave.open(file_path, "rb") as wf: