openairplay / goplay2

Airplay 2 Receiver written in Go
Apache License 2.0
384 stars 20 forks source link

Adding ALSA volume control #11

Closed noelhibbard closed 3 years ago

noelhibbard commented 3 years ago

This PR adds support for volume control. It adds the ---alsamixer command line option and if supplied it will control the volume. If not, volume control is disabled. The volume state is also stored and persists between sessions.

The easiest way to find the mixer name is to run alsamixer while playing some music and play around with all the sliders until you find the correct control. Take note of the name of the control at the bottom. That will be the name you would supply with the --alsamixer option.

This is my first stab at Go Lang so I'm sure my code could be streamlined. But it does work at least. :)

AlbanSeurat commented 3 years ago

Thanks for the contribution. some comments :

Would you mind changing that ? I can merge the code as-is for the sake of having the functionality and do the change myself if you prefer