-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use rodio for the jackaudio backend #548
Conversation
I'm glad you got it working. Honestly I'd be inclined to replace the existing Jack back-end completely. Ideally we could keep the existing I'd update the non-trait functions in IDK of a neater solution right now w.r.t. struct layout. But the more we trend towards more backends being managed by CPAL the better. |
Thanks for the help @willstott101, I integrated your suggestions and seems to work as supposed to! I just couldn't find a way to implement the Sink trait once for both RodioSink structs as you suggested so I duplicated the method but this should have no influence on usage. |
I think moving to jack through rodio makes sense, less for us to deal with. Did you fix the |
Hi @sashahilton00, I merged the upstream into my fork in order to resolve a conflict but this now triggers a new error in the checks. When investigating I found that the Rust 1.40 test fails at compilation because of the This being unrelated to the PR and all other tests passing, I think this is good to go as is. |
Looks like we'll need to bump the MSRV for this PR. Also, the git commit history will need to be cleaned up. |
The 1.40 issue is the same as in #585 |
7813b33
to
97554d9
Compare
Don't worry about the cargo build --no-default-features --features "jackaudio-backend"
Compiling librespot-playback v0.1.3 (/Users/sashahilton/Documents/librespot/playback)
error[E0599]: no variant or associated item named `Jack` found for enum `audio_backend::rodio::cpal::HostId` in the current scope
--> playback/src/audio_backend/rodio.rs:126:49
|
126 | .find(|id| *id == cpal::HostId::Jack)
| ^^^^ variant or associated item not found in `audio_backend::rodio::cpal::HostId`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: could not compile `librespot-playback`.
To learn more, run the command again with --verbose. |
Ah, I didn't think about the different platforms. Cpal (and hence rodio) has only implemented a jack host for linux-like platforms.. I think this could maybe be added for macOS, I'm going to set up a VM to try this out. Ps: I think that |
Ideally I'd like to see Windows and Mac support for Jack. The jack bindings crate has support for it, so it shouldn't be much trouble to make this possible, though it will depend on upstream cpal/rodio. Given that upstream could take a while, I'd be happy to include this as a linux only feature currently, but the existing jack audio backend that supports mac and windows should remain, and a note clarifying the difference between the rodio and jack backends should be made in the readme/wiki, explaining that the old jack backend will eventually be going away once rodio supports mac/windows. That way one can pursue upstream support without blocking this feature, which I know has been desired for quite a while for certain use cases.
Yes, if it is required then it should be added in the wiki. |
I'll be making a new release in the next day or so, if we want this to be included then the rodiojack feature will need to require Linux as the target os in its current format. Then support for other systems can be added once there is support upstream |
97554d9
to
52438b1
Compare
Ok sounds good to me :) |
1d02432
to
aad4dba
Compare
@Lcchy merged. If you could update the wiki that would be great. Also, with regards to mac/windows support upstream, is that something you're willing to pursue? |
Yes, that's something I planned on doing. I am going to open a PR on cpal and open one here once it gets merged, if that is all right with you. |
Hey @sashahilton00, just a heads up as I have been busy with work and could not get to making the upstream compatible, sorry about that. |
No problem. Are you still intending on pursuing at a later date or done until further notice? |
One day maybe but it's definitely more done until further notice. |
Thanks @willstott101 for updating rodio to 0.13 and making this possible!
This works as is with jack at any sample rate (and solves #316, and #343 ?)
The choice to put this in a separate feature called
rodiojack-backend
is deliberate. I tried to simply add the jack cpal devices to the alsa ones all together inrodio-backend
yet as alsa and jack are exclusive, this always prints an error (either jack or alsa) to the terminal when checking on available devices. This can be tested here.ps: You have to build without using the
--no-default-features
, please let me know if you see how to fix this (it seems to deactivate rodio for rodiojack)FYI: I still think that having all rodio devices in one backend is better, I will try to see in the next few days if I can catch the error messages somehow