From c01bdb8b9692602a7ec2772c39e43e586266457f Mon Sep 17 00:00:00 2001 From: pstruebi Date: Mon, 3 Nov 2025 16:12:09 +0100 Subject: [PATCH] feat: add detailed audio device logging for input stream setup - Added comprehensive logging of audio device configuration when opening input stream - Included host API name, device details, channel count, and latency parameters in logs - Added PortAudio version logging to help with troubleshooting - Implemented error handling for device query failures with warning log output --- src/auracast/multicast.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/auracast/multicast.py b/src/auracast/multicast.py index aa05cdb..a1f99f7 100644 --- a/src/auracast/multicast.py +++ b/src/auracast/multicast.py @@ -60,7 +60,29 @@ class ModSoundDeviceAudioInput(audio_io.SoundDeviceAudioInput): def _open(self): """Patched _open method that creates RawInputStream with low-latency parameters.""" - + try: + dev_info = sd.query_devices(self._device) + hostapis = sd.query_hostapis() + api_index = dev_info.get('hostapi') + api_name = hostapis[api_index]['name'] if isinstance(api_index, int) and 0 <= api_index < len(hostapis) else 'unknown' + pa_ver = None + try: + pa_ver = sd.get_portaudio_version() + except Exception: + pass + logging.info( + "SoundDevice backend=%s device='%s' (id=%s) ch=%s default_low_input_latency=%.4f default_high_input_latency=%.4f portaudio=%s", + api_name, + dev_info.get('name'), + self._device, + dev_info.get('max_input_channels'), + float(dev_info.get('default_low_input_latency') or 0.0), + float(dev_info.get('default_high_input_latency') or 0.0), + pa_ver[1] if isinstance(pa_ver, tuple) and len(pa_ver) >= 2 else pa_ver, + ) + except Exception as e: + logging.warning("Failed to query sounddevice backend/device info: %s", e) + # Create RawInputStream with injected low-latency parameters self._stream = sd.RawInputStream( samplerate=self._pcm_format.sample_rate,