Merge branch 'wip_alsaaudio' TODO poetry lock

This commit is contained in:
Pbopbo
2026-04-09 11:51:37 +02:00
8 changed files with 162 additions and 88 deletions

View File

@@ -73,6 +73,10 @@ def _led_off():
except Exception:
pass
# Configure bumble debug logging
# log.getLogger('bumble').setLevel(log.DEBUG)
# make sure pipewire sets latency
# Primary and secondary persisted settings files
STREAM_SETTINGS_FILE1 = os.path.join(os.path.dirname(__file__), 'stream_settings.json')
@@ -439,18 +443,15 @@ async def init_radio(transport: str, conf: auracast_config.AuracastConfigGroup,
if is_stereo and sel == 'ch1':
# Stereo mode: use ALSA directly to capture both channels from hardware
# ch1=left (channel 0), ch2=right (channel 1)
big.audio_source = 'alsa:hw:CARD=i2s,DEV=0'
big.audio_source = 'device:hw:2'
big.input_format = f"int16le,{hardware_capture_rate},2"
log.info("Configured analog stereo input: using ALSA hw:CARD=i2s,DEV=0 with ch1=left, ch2=right")
elif is_stereo and sel == 'ch2':
# Skip ch2 in stereo mode as it's already captured as part of stereo pair
continue
else:
# Mono mode: individual channel capture
device_index = resolve_input_device_index(sel)
if device_index is None:
raise HTTPException(status_code=400, detail=f"Audio device '{sel}' not found.")
big.audio_source = f'device:{device_index}'
# Mono mode: use dsnoop virtual device directly (ch1=left, ch2=right)
big.audio_source = f'device:{sel}'
big.input_format = f"int16le,{hardware_capture_rate},1"
continue
@@ -1007,7 +1008,7 @@ async def _startup_autostart_event():
_led_off()
# Run install_asoundconf.sh script
script_path = os.path.join(os.path.dirname(__file__), '..', 'misc', 'install_asoundconf.sh')
script_path = os.path.join(os.path.dirname(__file__), '..', '..', 'misc', 'install_asoundconf.sh')
try:
log.info("[STARTUP] Running install_asoundconf.sh script")
result = subprocess.run(['bash', script_path], capture_output=True, text=True, check=True)