Fix: Audio not playing on Windows#34
Conversation
|
@teancom @marcelveldt can I get a review of this one as it's a major issue for users |
|
Tested on Windows 11 with a TOPPING USB DAC and ran into a hi-res-DAC edge case the current fix doesn't cover. Posting in case it's useful. 👋 Heads up: I'm not a Rust dev — I used Claude Code to clone the fork, build, debug the stderr output, and write the patch below. So I can answer questions about the symptoms / what I tested, but for deep questions about the diff itself you may want to verify it independently. Repro: DAC default format set to 384000 Hz / 24-bit in Windows Sound → Properties → Advanced (common for audiophile DACs). With the patch applied, audio still doesn't play. Diagnostic from stderr: [Sendspin] Using default output device: Speakers (TOPPING USB DAC) On Windows shared-mode WASAPI, cpal::Device::supported_output_configs() returns only configs at the device's currently configured shared-mode rate. For my DAC that's [ch=2, rate=384000..384000Hz, fmt={U8|I16|I32|F32}]. The current derive_supported_pcm_formats checks [48000, 44100, 96000] against that range, all fail (rate < min_rate), the function returns empty, and fallback_supported_formats() (48k/44.1k 16-bit) is advertised — which the device then rejects when cpal tries to open the stream at 48k against a 384k mix format. Workaround for users hitting this: change Windows default format to 48000 Hz. But that defeats the point of a hi-res DAC. Suggested fix: Anchor on device.default_output_config() so the device's native rate is always advertised, and add common rates only when supported_output_configs() actually covers them. Full replacement function I've been running locally: pub fn derive_supported_pcm_formats(device: Option<&cpal::Device>) -> Vec { } |
teancom
left a comment
There was a problem hiding this comment.
This looks lovely, thank you! A few things to tweak but I think this will be a great change.
e619ac3 to
b664686
Compare
can you have a pull of the latest version and see if it works for you now please :D |
teancom
left a comment
There was a problem hiding this comment.
One final tweak and we're good to go!
|
@RobinDadswell Confirmed working at 384kHz on the TOPPING USB DAC with the latest commit — no Windows audio config changes needed. 🎉 Thanks for the quick turnaround on the fix! |
This may also fix issues on other devices, however this is not confirmed as I do not have alternative Operating Systems to check on
b664686 to
08a5c00
Compare
|
Thanks, @RobinDadswell ! |
This may also fix issues on other devices, however this is not confirmed as I do not have alternative Operating Systems to check on
It also allows for changing the audio device to output through without needing to restart the whole application