Fix audio distortion in float -> int32 conversion.

This was noticeable when using sox filter and become prominant when
libavcodec introduced per-codec audio sample formats.
Also, add CLAMP to make code more readable.