feat: enforce 48kHz audio capture and fix device detection
- Changed audio capture rate to fixed 48kHz instead of using device default to prevent resampling latency and 44.1kHz compatibility issues - Updated device detection to use get_alsa_usb_inputs() instead of get_usb_pw_inputs() for more accurate USB audio device discovery - Maintains original channel count logic to use maximum of 2 channels based on device capabilities
This commit is contained in:
@@ -198,7 +198,8 @@ class StreamerWorker: # TODO: is wraping in this Worker stricly nececcarry ?
|
||||
if big.audio_source.startswith('device:'):
|
||||
big.audio_source = f'device:{device_index}'
|
||||
devinfo = sd.query_devices(device_index)
|
||||
capture_rate = int(devinfo.get('default_samplerate') or 48000)
|
||||
# Force capture at 48 kHz to avoid resampler latency and 44.1 kHz incompatibilities
|
||||
capture_rate = 48000
|
||||
max_in = int(devinfo.get('max_input_channels') or 1)
|
||||
channels = max(1, min(2, max_in))
|
||||
for big in conf.bigs:
|
||||
@@ -446,7 +447,7 @@ async def _autostart_from_settings():
|
||||
):
|
||||
return
|
||||
# Check against the cached device lists
|
||||
usb = [d for _, d in get_usb_pw_inputs()]
|
||||
usb = [d for _, d in get_alsa_usb_inputs()]
|
||||
net = [d for _, d in get_network_pw_inputs()]
|
||||
names = {d.get('name') for d in usb} | {d.get('name') for d in net}
|
||||
if input_device_name in names:
|
||||
|
||||
Reference in New Issue
Block a user