mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #786] [CLOSED] Add CPAL backend #1079
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#1079
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/786
Author: @roderickvd
Created: 6/1/2021
Status: ❌ Closed
Base:
dev← Head:cpal-backend📝 Commits (10+)
998fc02Add cpal backend938029bMerge remote-tracking branch 'Johannesd3/cpal-backend-simple' into cpal-backendcf3b7dfUse default format when requested format is unsupported9de54f4Implement start/stop for CPAL3962d63Fix compilation on Rust < 1.5023ed104Tune ring buffer sized8ab4bdAddcpaljackbackendf648c9fUse generic instead of macro939e081Fix build forcpaljackwithoutcpalbackend6c45a1aBuffer size is in elements not bytes📊 Changes
5 files changed (+345 additions, -5 deletions)
View changed files
📝
Cargo.lock(+16 -0)📝
Cargo.toml(+4 -2)📝
playback/Cargo.toml(+6 -3)➕
playback/src/audio_backend/cpal.rs(+312 -0)📝
playback/src/audio_backend/mod.rs(+7 -0)📄 Description
This is a working CPAL backend based on the extensive initial work by @Johannesd3 (thanks!).
The intention is to deprecate Rodio in favour of CPAL: Rodio is based on CPAL, and builds on it, but there is nothing extra we need in Rodio that isn't already in CPAL. This has been discussed in various places, notably #648 and https://github.com/librespot-org/librespot/discussions/734#discussioncomment-725127.
So far I have successfully tested this backend on Linux (
S16,F32) and macOS (F32).Todo
CpalJackvariant (like we also haveRodioJack)Open questions
What do we want to do with the Rodio backend for the upcoming release: replace it with CPAL? Or keep it around for planned deprecation in a release sometime later?
The code that checks whether the requested audio format is available, or falls back to the system default otherwise, actually returns the highest supported audio format by default. CurrentlyNo it would work with idiosyncracies for every backend and not be very transparent to the user.librespotdefaults toS16but this code gives another opportunity: we could change format selection to anOption<AudioFormat>, selecting the highest quality by default unless specified otherwise. For other backends, that do not easily support querying supported formats, we could still default toS16unless specified otherwise. Should we get this in or leave it be? This would be another PR but I'd first like to hear your thoughts before I put time in.For an out-of-the-box experience on Windows, we need resampling. Do we want to add this, or forget about this PR and stick with Rodio? See: https://github.com/librespot-org/librespot/pull/786#issuecomment-852891109
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.