Open bryal opened 4 years ago
Implementing this in a media player and operating system agnostic way sounds tricky. Instead we could add media player specific commands for changing the volume prefixed with the media player, starting with eradio-mpv-xyz
. This obviously implies changing the mpv command to make the socket.
Alternatively we could do this on an audio system level and interface with pactl(1), SNDIOCTL(1) etc. I don't know how to go about this on MacOS though.
PRs are welcome.
Cool programming language btw, very based license :-)
I've implemented a version of this functionality in a very ad-hoc fork in my own emacs conf, but I don't know if the functionality is quite merge-ready. For example, I realized that MPV doesn't remember the volume when resuming after a stop, or changing the channel, so I added a variable eradio-volume
which I change along with sending set volume
commands to MPV, so when the process is restarted the previous volume is passed along with --volume
. Maybe it's good enough, but the solution just feels a bit inelegant to me.
Cool programming language btw, very based license :-)
Thanks! Indeed, I feel it's the one license ;)
It would be nice to be able to raise and lower the volume directly in Emacs, not having to open Pavucontrols or equivalent to manually change the volume of the process. Not sure if it would be easy to come up with a solution portable between all the backends though, but for MPV it can be done with the --input-ipc-server flag and ncat. Example:
I suppose the functions would look something like
except they would do something different depending on the backend.
An alternative solution which would probably work for most situations could be to ask the user for volume when executing
eradio-play
and pass that along as a command line argument when starting the player process. For MPV, there's the--volume
flag. This solution would not allow changing the volume without restarting the player, but that's not all that bothersome, so it would still be very useful.