Yes indeed, it has all been in linux. I don't even have a windows C compiler, so I can't really builda winamp plug-in. Mind you, the code is intended to be used by other code. It is a very simple API. If you have access to some plugin source, it ought to be trivial to make it use my code.

Basically, you initialise the thing with the blocksize (this must remain constant, but that's no problem on the empeg), db per second, minimum volume level and headroom.

Then you simply call two functions (voladj_check and voladj_scale) alternately on your raw data (16 bit samples). voladj_scale modifies the samples in place (which I think answers your second question).

There's a structure which holds all the long-lived data that gets passed back and forth, so if you wanted you could rig up some sort of mechanism to adjust it in real time. The code at the moment just sets up the parameters to start with and then leaves them alone.

The whole thing is especially designed to be as little effort as possible for the guys at empeg to integrate into the player. I've even been testing it on blocks of 4608 bytes. Presumably the data is already in blocks like this before it is written to the audio device. All they need to do is call a couple of functions on it before they do the write.

You can hopefully find the code at http://home.eric.net.au/~rjlov/compress.c.

You will have to compile it with the math libraries (use -lm with gcc). The floating point is only used in the initialisation. All the actual processing is done with fixed point numbers. By the way, this software will probably work best if your samples have initially been normalised to the maximum value.

It's currently written with the philosophy that clipping is bad, and must be avoided at all costs. That could be changed. It also would be pretty easy to change voladj_check to calculate a desired multiplier based on the average power, rather than the peak volume, as people have described in this thread.

This is my first attempt at fixed point non-integer arithmetic, so I've probably done things a bad way. If you have suggestions, feel free to tell me or make the improvements yourself.

Richard.