Closed tooxo closed 2 months ago
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.
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.
@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_attach
is not the device name, perhaps you can help me with that?
@devgianlu Thank you for implementing!
The string passed to snd_mixer_attach
is 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!
The string passed to
snd_mixer_attach
is not the device name
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?).
@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.
Take your time! Closing this for now, feel free to re-open if you find out any problem with the current implementation.
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.