feat(microphone): Protocol + create_monitor() Factory-Skeleton

This commit is contained in:
2026-05-14 17:35:59 +02:00
parent 67687a9b43
commit 02496fb708
+23
View File
@@ -0,0 +1,23 @@
# whisper_local/microphone/__init__.py
"""Mikrofon-Geräteüberwachung — plattformspezifische Backends."""
import sys
from collections.abc import Awaitable, Callable
from typing import Protocol
class MicrophoneMonitor(Protocol):
on_device_added: Callable[[str], Awaitable[None]] | None
on_device_removed: Callable[[str], Awaitable[None]] | None
on_configured_missing: Callable[[], Awaitable[None]] | None
async def start(self) -> None: ...
def stop(self) -> None: ...
def create_monitor(configured_device: str | None) -> MicrophoneMonitor:
"""Erstellt den plattformspezifischen Mikrofon-Monitor."""
if sys.platform == "win32":
from whisper_local.microphone._win32 import Win32Monitor
return Win32Monitor(configured_device)
from whisper_local.microphone._poll import PollMonitor
return PollMonitor(configured_device)