fix: auto-recover audio pipeline on device disconnect - #529
Conversation
- Add isActive check to updateOutputs() and off-state onSoundDeviceChange() to prevent inactive devices from being included in active device list - Rewrite on-state onSoundDeviceChange() to properly re-power the audio pipeline when switching to a new device after disconnection - Add reloadDevices() as manual fallback for edge cases Fixes fxsound2#40, fxsound2#269, fxsound2#220, fxsound2#367, fxsound2#468
|
Thanks @Sanslayerbe for this fix. I will review it. |
|
Please retarget this PR to develop/windows branch |
|
@claude review this PR and see if it fixes anything that is missed in the previous fixes for device detection |
|
Claude finished @bvijay74's task in 6m 53s —— View job Review: does this fix what earlier device-detection fixes missed?
Short answer: partially. The core "re-power after switching devices" fix (bug #2) is real and is the part earlier fixes were missing. However, two of the three claimed root causes don't actually do what the PR description says, one edge case (all-devices-removed while FxSound is off) is still unfixed, and the new rewritten path introduces a small regression. Details below. 1.
|
|
@Sanslayerbe Can you please address the review comments? |
Problem
When an active audio device is disconnected (Bluetooth, USB DAC, etc.),
FxSound often enters a hung state where audio stops and the only
recovery is restarting the app.
Relates to #40, #269, #220, #367, #468
Root Cause
Three bugs working together:
updateOutputs()(line 1027) doesn't checkisActive, sodisconnected devices remain in the active device list.
initOutputs()does this check correctly but
updateOutputs()was missing it.onSoundDeviceChange()doesn't re-power the audio pipelineafter selecting a new device —
powerOn(true)andunmutearenever called after a device switch during removal.
setOutput(), permanently muting the app with no recovery path.Changes
updateOutputs(): Added missingisActivecheck to matchthe filtering in
initOutputs()(one-line fix)onSoundDeviceChange(): SameisActivefixonSoundDeviceChange(): Rewritten to properlyre-enumerate devices, select the best available output, and
explicitly re-power the audio pipeline if the user had it on
reloadDevices(): New public method for manual recovery asa fallback for edge cases (driver glitches, rapid connect/disconnect)
Testing