Sorry for reporting two bugs in a single report, but otherwise I'd have
to submit two patches that depend on each other.
I hope that the patch can be applied soon because these two flaws make
the module quite unusable in my opinion.
1) I noticed that the PCM sound data produced with Audio::Mad on my
system includes a lot of crackling. While investigating this problem
by running the example script (from the perldoc) with valgrind, I got a
lot of messages like:
==27651== Conditional jump or move depends on uninitialised value(s)
==27651== at 0x403C3B1: mad_dither_linear (dither.c:81)
==27651== by 0x403C642: mad_dither_s16_le (dither.c:149)
==27651== by 0x403B0D9: XS_Audio__Mad__Dither_dither (Mad.xs:535)
==27651== by 0x80BBD01: Perl_pp_entersub (in /usr/bin/perl5.8.8)
I found out that there were some uses of SvLEN where SvCUR would have
been appropriate; i.e. Perl often allocates 4 unneeded bytes for string
buffers, and they were included as uninitalized memory in the PCM data.
2) When you compile Audio::Mad with gcc version 4, the compiler will
bail out with a lot of error messages like this:
Mad.xs: In function 'XS_Audio__Mad__Stream_new':
Mad.xs:44: error: lvalue required as left operand of assignment
I could fix this by changing all the "Newz" calls.