Hot-Plug
USB MIDI / audio disconnect mid-show is handled gracefully. The show keeps running.
Target version: v0.3
The problem
Every working musician has had a USB MIDI cable wiggle mid-show. Most music software treats device disconnect as fatal — audio stops, sometimes the app crashes. Stardust doesn’t.
What Stardust does
When a MIDI device disconnects:
- Detected via platform notifications (CoreMIDI on macOS, WinMM on Windows)
- UI shows non-blocking toast: “Roland RD-2000 disconnected”
- The audio engine keeps running with remaining devices
- Any notes currently held on the disconnected device’s channels get an automatic note-off (prevent stuck notes)
- Voice tracker entries for the device are cleared
When the device reconnects:
- Auto-detected via the same notifications
- UI shows toast: “Roland RD-2000 reconnected”
- Mappings auto-restore (the device profile matches by ID, so settings re-apply)
- Show continues
Audio device hot-plug
Similar handling for audio devices:
- USB audio interface disconnects → fall back to system default output (laptop speakers if nothing else)
- “Audio interface lost — falling back to built-in” toast
- On reconnect, you can manually switch back via Settings (don’t auto-switch — could be intentional)
Better silence-or-laptop-speakers than total dropout.
Platform-specific implementation
macOS
- CoreMIDI:
MIDIClientCreate+MIDIRestartfor device list updates - CoreAudio:
AudioObjectAddPropertyListenerfor device list changes - Both signal asynchronously; we handle in a non-RT thread and queue events to the audio thread via lock-free channel
Windows
- WinMM: poll
midiInGetNumDevs()periodically (no clean push notification) - WASAPI:
IMMDeviceEnumerator::RegisterEndpointNotificationCallback - Same lock-free queueing to audio thread
Linux (post-1.0)
- ALSA: poll via
udevevents - Same architecture
Why most music software doesn’t bother
Implementing this properly is annoying:
- Different APIs per platform
- Edge cases (device that disconnects and reconnects 10 times in a second)
- Race conditions with audio callback timing
- Cleanup state (what if a note was being held when device vanished?)
Stardust does the work because every musician has lived through this failure mode.
What happens to held notes
When a MIDI device disconnects mid-note:
- Voice tracker tracks every active note by source device
- On disconnect, all notes from that device get auto note-off
- Plugin sustain is cleared (sustain-off broadcast)
- No stuck notes
If the audio device disconnects:
- Sound just stops (can’t output to disconnected device)
- Voice tracker still cleans up notes when device returns
- Held notes that wanted to continue won’t be heard, but won’t be stuck either
UI feedback
Live Mode shows MIDI activity dots per device. When a device disconnects:
- Its dot turns red / fades out
- Tooltip: “Device disconnected”
- When it reconnects, dot returns to normal
Persistent notification in the status bar: “Roland RD-2000 disconnected · click to dismiss”
Phase status
| Phase | What’s available |
|---|---|
| v0.3 | MIDI + audio hot-plug detection, graceful recovery, voice cleanup |
| v0.4 | UI indicators in Live Mode |
| v0.5+ | Smarter audio reconnect (auto-switch back if user prefers) |
Related pages
- Voice Tracking
- Plugin Crash Isolation
- Device Profiles (profile auto-applied on reconnect)