JasonWei512 / code-radio-cli

🎵 A command line music radio client for https://coderadio.freecodecamp.org, written in Rust.
https://crates.io/crates/code-radio-cli
MIT License
348 stars 16 forks source link

changing system audio output device requires code-radio restart #7

Open shnewto opened 1 year ago

shnewto commented 1 year ago

Hello! I love this crate! thanks for putting it together 😄

I noticed that when code-radio is playing in my terminal (macOS 13.0.1, Intel, iTerm2 Build 3.4.18), if I switch my audio output device, code-radio doesn't play there unless I quit and restart. So for instance, if I'm listening on my laptop speakers then plug in headphones, I have to restart code-radio to get in in the headphones.

By no means is this a big deal for me, it's simple to just restart, but I thought I'd raise the issue in case it's not on the radar.

JasonWei512 commented 1 year ago

It's a known issue and the default behavior of rodio and cpal. I am facing the same issue on my Windows laptop. I am also looking for a workaround. Will look into it when I have time.

Some related issues:

shnewto commented 1 year ago

ah sounds great, thanks for the pointers!

JasonWei512 commented 1 year ago

Thanks for #9! I have released 1.0.2 to crates.io.

However the problem still exists on Windows. Looks like cpal implemented the audio device switching logic for macOS but not for Windows.

Could you keep this issue open?


Update:

https://github.com/RustAudio/rodio/issues/463

https://github.com/RustAudio/cpal/issues/740

shnewto commented 1 year ago

ohh yeah if it's still the case for windows keeping this open makes good sense. thanks for the new release!