Because I still see people adding noise or offset to their signal to avoid slow
denormalization, here's a piece of code to zero out (near) tiny numbers instead.
Why zeroing out is better? Because a fully silent signal is better than a little offset,
or noise. A host or effect can detect silent signals and choose not to process them in a
Plus, adding an offset or noise reduces huge packets of denormalization, but still leaves
Also, truncating is what the DAZ (Denormals Are Zero) SSE flag does.
This code uses integer comparison, and a CMOV, so you need a Pentium Pro or higher.
There's no need for an SSE version, as if you have SSE code you're probably already using
the DAZ flag instead (but I advise plugins not to mess with the SSE flags, as the host is
likely to have DAZ switched on already). This is for FPU code. Should work much faster
than crap FPU comparison.
Den_Thres is your threshold, it cannot be denormalized (would be pointless). The function
is Delphi, if you want to adapt, just make sure EAX is the buffer and EDX is length
(Delphi register calling convention - it's not the same in C++).