mirror of
https://github.com/devgianlu/go-librespot.git
synced 2026-04-26 05:15:49 +03:00
[GH-ISSUE #36] Add support for alsa mixer volume #30
Labels
No labels
bug
enhancement
pull-request
spotify-side
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/go-librespot#30
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 @tooxo on GitHub (May 19, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/36
Right now, if the "external volume" configuration option is enabled, the spotify volume slider does nothing, so I propose that it at least should be possible to update the volume of for example an alsa mixer.
I have written a short snippet on how it could be implemented, but I am not sure how to implement it into the project without creating a mess.
@devgianlu commented on GitHub (May 20, 2024):
Hello, thank you very much for this! I am in the process of refactoring the linux audio driver to allow for better crossfade / gapless capabilities. I'll keep this in mind so that it can be implemented at some point.
@tooxo commented on GitHub (May 20, 2024):
Another nice-to-have would be if the spotify-internal volume would be set to the mixer volume on connect or at least on startup of the daemon.
Edit: Also, let me know when you are done with your refactoring work, I'll be happy to implement the feature myself.
@devgianlu commented on GitHub (May 26, 2024):
@tooxo I've just implemented this (sorry didn't see your note about implementing it yourself in time). It seems to be working pretty good, let me know if there's any mistake in the implementation or things I didn't think of. I am not really an expert at ALSA stuff.
Edit: I have just noticed that the string passed to
snd_mixer_attachis not the device name, perhaps you can help me with that?@tooxo commented on GitHub (May 26, 2024):
@devgianlu Thank you for implementing!
The string passed to
snd_mixer_attachis not the device name, but the name of a "high level control interface". I am also not 100% sure what this is supposed to mean, but it seems to be an abstraction of a mixer within ALSA. Usually every alsa device with a mixer also has a HLCI with the name of the device connected to it, I would have to do some further research on this. To maybe prevent errors here this could be a field in the config file.I like your implementation, but for my use-case it would be even better if the program doesn't touch the alsa mixer volume once, but sets the volume of spotify to the current alsa volume maybe while connecting or during startup.
Synchronization with the alsa mixer could also be realized with callbacks, which are also supported.
I am still interested in helping, if anything comes up!
@devgianlu commented on GitHub (May 26, 2024):
Yeah I had this feeling, I have moved it to a separate configuration variable for better customization.
I didn't initially realize what you meant for the synchronization of the volume: perhaps that could be a separate issue considering it requires some additional tinkering (especially because of callbacks I imagine). Or feel free to open a PR directly if you feel confident about it! Only thing I know already is that we may want it to be toggleable from the configuration (opt in / opt out?).
@tooxo commented on GitHub (May 26, 2024):
@devgianlu I'll look what I can do, but it all should definitely be opt-in, because it can create some really mysterious errors if your alsa configuration is funky.
@devgianlu commented on GitHub (May 26, 2024):
Take your time! Closing this for now, feel free to re-open if you find out any problem with the current implementation.