This hopefully may work:
It Implements auto shutdown when no sound is played, i do not know how reliable this works yet tho.
Further it takes settings as arguments.
"Speed" is the polling delay in μs, default is 100000 which is 0.1s.
"Range" is the expected max wheel value, default is 2000 which causes it to go up to 102%. Lower values may break your ears, higher ones will lower the max volume.
"volume Speed 2000000 Range 4000" Will give you 2s polling time and and a 50% max volume.
There is no pulse integration but instead a very ugly system call. This has pros and cons, mainly turning the wheel uses more resources while its using less resources all other times.
I tried to include it but coding wise pulse is a monster to integrate, even if you manage to do it, no one would be willing to maintain it, let alone solving all the compiling problems.
So i stop here saying this is no smart move.
Benchmark: Obviously while nothing is playing the usage is zero.
But in usage there is no noteworthy difference to the already existing pyra_volume.c file.
This quick test shows slight tendency towards my tool:
real 1m1,233s
user 0m0,025s
sys 0m0,423s
vs pyra_volumed:
real 1m3,811s
user 0m0,100s
sys 0m0,582s
But ive seen other results too, so one needs to run it way longer to actually see a difference, in theory they should be identical.
Test this and report any misbehaving.
Also, its not written in lua this time, i shaved that cause i thought i needed it for pulse, ohwell, jokes on you, a lua version would be one if case shorter.
EDIT: I have not accounted that paths change on reboot. This tool will maybe just do nothing at all when invokened since it monitors the wrong file
Ill fix this tomorrow. Blah, its always the tiny little details...