@ricardo
If you would change each samplevalue by an individual factor (e.g. depending on the difference of the peak and the actual samplevalue), you would change the shape of the wave.
A pure sine-wave would become more like a rect-shape, because the more silent samples are increased a lot, the more loud samples just a bit.
Modifiing the shape results in modifiing the frequencies, so perhaps you would create a cool effect, but no clean normalization.
For a "normalization" where the louder parts are increased only a bit, and the silent ones more intensive you would have to specify the loudness in a time-frame of e.g. 100-1000 ms. and in/decrease the actual volume-factor by the average loudness of this time-frame. The changes of the volume-factor itself must not work immediately, but with an attack/decay-speed of e.g. 20+ ms.
Further the whole algorithm could (if you want) start only if the average volume lies under a defined treshhold-value.
This is the concept of an expander - it's working just the other way round than a compressor.
I cannot imagine any other concept for 'normalization' than simply changing the volume of your whole sound depending on the maximum value inside it, but perhaps (ALWAYS ANYTHING is 'perhaps' - fu**ing chaos-theory

) I'm wrong.
@blueznl
Using fmod for this really makes fun (if you have the time for it).
You can access the actual bufferdata in realtime through a callback-procedure. Inside your procedure you can do anything with the sampledata (stereo 16-Bit integer) Or you could create your own sampledata for creating sounds.
@Num3
It ENcodes AC3 for free ?? cool!