mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #220] [MERGED] Cache volume across restarts #841
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#841
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/220
Author: @bricedp
Created: 5/11/2018
Status: ✅ Merged
Merged: 5/17/2018
Merged by: @plietar
Base:
master← Head:cache-volume📝 Commits (10+)
47d1e54create Volume struct for use with Cache141916aadd "volume" file to Cached7708eeload cached volume on start, intial overrides cached overrides defaultab73804amend volume_to_mixer function to cache the volume on every change814e371pass cache to Spirc and SpircTask so volume_to_mixer has accesse71c7d3rustfmt changes3975745revert volume_to_mixer function and Spirc/SpircTask cache variablee901456Volume implements Copy, pass by value instead of referenceaca3428clamp volume to 100 if cached value exceeds limit8f36283convert Volume to u16 internally, use float and round to convert hex->dec📊 Changes
8 files changed (+84 additions, -26 deletions)
View changed files
📝
connect/src/spirc.rs(+18 -14)📝
core/src/cache.rs(+18 -0)📝
core/src/config.rs(+1 -1)📝
core/src/lib.rs(+1 -0)➕
core/src/volume.rs(+31 -0)📝
examples/play.rs(+1 -1)📝
playback/src/audio_backend/jackaudio.rs(+4 -2)📝
src/main.rs(+10 -8)📄 Description
This is a continuation of https://github.com/librespot-org/librespot/pull/218. Now, volume is cached when the user supplies the
--cachedirectory.--initial-volumeoverrides cached volume, which in turn overrides the default hard-coded volume.Currently, the volume is stored in a plaintext file containing only the (percentage) volume. In the future, it could be expanded into a config.json with other parameters as well, since I've largely copied the way that the credentials are stored in credentials.json.
I don't know if the final commit (passing to
SpircandSpircTask) is the most elegant way to access the cache fromvolume_to_mixer, so I'm open to any improvements to that aspect.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.