On-demand audio visualizer capture + UI fixes
- Audio capture starts only when first client subscribes, stops when last client unsubscribes (saves CPU/battery) - Add lifecycle lock to AudioAnalyzer for thread-safe start/stop - Status badge uses local visualizer state instead of server flag - Fix script name vertical text break on narrow screens - Fix script grid minimum column width on small viewports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -305,15 +305,9 @@ async def set_visualizer_device(
|
||||
device_name = request.get("device_name")
|
||||
analyzer = get_audio_analyzer()
|
||||
|
||||
# Restart with new device
|
||||
was_running = analyzer.running
|
||||
# set_device() handles stop/start internally if capture was running
|
||||
success = analyzer.set_device(device_name)
|
||||
|
||||
# Restart audio broadcast if needed
|
||||
if was_running and success and analyzer.running:
|
||||
await ws_manager.stop_audio_monitor()
|
||||
await ws_manager.start_audio_monitor(analyzer)
|
||||
|
||||
return {
|
||||
"success": success,
|
||||
"current_device": analyzer.current_device,
|
||||
|
||||
Reference in New Issue
Block a user