fix(audio): handle device disconnects and auto-resume on reconnect - #38
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #33 where disconnecting a Bluetooth or USB audio device while the pipeline was running left the engine in a stuck "pipeline already running" zombie state that could neither be stopped nor restarted.
Specifically:
channels == 0), making connected but idle Bluetooth devices invisible in the picker. We now check if the device is alive and paired via CoreAudio transport properties so they remain selectable.0.0). File recordings stay open without splitting, speakers don't pop or drop out, and intermediate effects (EQ, gain, VSTs) keep their state.Keep pipeline running on disconnect(enabled by default). Users who prefer the pipeline to stop immediately on any device disconnect can turn it off.engine::Command::Stopidempotent, and ifreconcilefails, the active state is cleanly reset (active = None) instead of leaving an orphaned running state.Why is this the right approach?
active = Some(...)forever. Resetting active state on failure and making stop idempotent prevents zombie states completely.Checklist
bun run checkpassescargo check --manifest-path src-tauri/Cargo.tomlpassesbun run formatleaves the tree cleanDspWorker::runPlatform coverage
Keep pipeline running on disconnecttoggle turned on and off.cargo test --manifest-path src-tauri/Cargo.toml --lib(141 tests pass) andbun run check(0 errors).Related