mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 09:25:49 +03:00
[GH-ISSUE #530] Config volume at 55% shows 54% in UI #1238
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#1238
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?
Originally created by @Column01 on GitHub (Jul 31, 2024).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/530
Describe the bug
When I set my config's volume to
55which is comfortable for me, the app launches at 54% volume. I thought "oh well maybe it's offset for some reason" so I set it to 56 in the config, and the app launches with 56% volume... very odd indeed.To Reproduce
Expected behaviour
Log and backtrace
spotify-player-24-07-31-17-58.zip
Screenshots
Environment
image,lyric-finder,media-controlbuilt with--releaseonAdditional context
Add any other context about the problem here.
@aome510 commented on GitHub (Jul 31, 2024):
Likely because how
volumeis set ingithub.com/aome510/spotify-player@fdb846e86e/spotify_player/src/streaming.rs (L171). It might be easy to tweak the calculation so that the percentage is right@Column01 commented on GitHub (Aug 1, 2024):
I don't think it can be fixed due to librespot's volume needing to be a u16 number like that. It's a rounding error as
65535 * 0.55is not a whole number@Column01 commented on GitHub (Aug 1, 2024):
One way that could "fix" it is to display the volume percentage in the UI as whatever its set in the config lol
@aome510 commented on GitHub (Aug 1, 2024):
right.
The displayed volume is what received from Spotify API, so it cannot be changed based on the configs
@Column01 commented on GitHub (Aug 1, 2024):
Ah yes, I assume this would be a problem if you used the app to adjust the volume for other spotify devices and of course as the user changes the volume using the hotkey it wouldn't update the config's value accordingly and this would still show 55%, bummer! Not sure what to do about this then other than suck it up :P
@Column01 commented on GitHub (Aug 1, 2024):
Actually, on this line in the client the volume is an i8, I think whats happening here is the UI is displaying this value AFAIK and instead of rounding (
36044/65535 = 0.5499961852445259rounded up would be 55%), it's chopping the decimals off making it "floor" the value and display 54% (again as far as I can tell)github.com/aome510/spotify-player@314631f9ce/spotify_player/src/cli/client.rs (L404)EDIT: NVM volume is u32 here so no its not flooring it here at least
@Column01 commented on GitHub (Aug 1, 2024):
But I don't fully understand the
is_offsetcheck so idk what that code block does if its not offset or what constitutes that flag being set@Column01 commented on GitHub (Aug 1, 2024):
Further digging revealed what you said is true (not that I doubted it, just wanted to know more). Rspotify returns the
volume_percentwhich is a u32 meaning our decimals are lost somewhere outside our control :(Gonna close this as afaik there is nothing that can be done to fix this