I'd forgotten half of this myself. I was looking at the code, and at first it looked like I had made the exact parameters dependent upon an internal constant in the kernel, but then I discovered that I had been slightly more intelligent than I had remembered.

Anyway....

The first parameter is the "factor per second". This is then shifted left 16 bits and expressed as an int. So to make voladj turn up the volume so that the output is increased by a factor of two every second, you set this to (2 << 16).
Weird things can happen if you set this very high or very low, but it should be OK to give it sensible values.

The second parameter is the minimum volume. It attempts to make this the quietest thing you hear. The units are sample magnitudes. If you set this to 0, then none of the other parameters should have any effect. If you set it to (1<<15)-1 then in theory everything should be the same volume, but more likely is that my log routines would get confused. Best to stick with numbers less than 30000, I think.

The third parameter is the "headroom". This attempts to reduce the number of times that a hasty volume correction is needed to prevent clipping. This is a fraction between 0 and 1, shifted left 16 bits and converted to an int. Mind you, it is currently ignored by the ioctl handling code, so changing it currently has no effect. To be nice, you should probably set this to 1 << 16.

The fourth parameter (real_silence) is the sample magnitude below which we assume that there is no listenable music present, so we gradually turn the volume back down.

The fifth parameter (fake_silence) is the sample magnitude that will get mapped to minvol. This must be greater than real_silence. Hm, I'll have to enforce that in the next version of my kernel patch, I think.

If your samples are between real_silence and fake_silence, then they are treated as if they were of magnitude fake_silence.


With respect to the timeout, selecter was not very smart. Basically, it would wait for 5 seconds, and if you didn't press anything, it would just leave the parameters as they were. So when you rebooted, it was _not_ using the value from before, it was actually using the default value that the kernel initialised. :)

Richard.