diff --git a/whisper_local/microphone/__init__.py b/whisper_local/microphone/__init__.py new file mode 100644 index 0000000..a613ce2 --- /dev/null +++ b/whisper_local/microphone/__init__.py @@ -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)