Audio-MPC
view release on metacpan or search on metacpan
lib/Audio/MPC.pm view on Meta::CPAN
These construct a new C<Audio::MPC> object. The compressed audio-data will
either come from I<file>, I<filehandle-ref> or from an I<Audio::MPC::Reader>
object (see L</"Audio::MPC::Reader"> further below for details).
Returns the newly created object or C<undef> in case of an error. In this case,
check C<< Audio::MPC->errstr >>.
=item B<decode> (buffer, [ MPC_LITTLE_ENDIAN || MPC_BIG_ENDIAN ])
Reads data from the audio-stream and puts the decoded PCM-samples into
I<buffer> which must not be readonly. The PCM data will be stereo (that is, two
channels) and 44.1 kHZ with each sample 16 bit wide.
The optional second argument specifies the byte-order of each sample. If not
specified, I<MPC_LITTLE_ENDIAN> is assumed.
Returns the length of I<buffer>, "0 but true" if the stream was succesfully
decoded with no more samples left and false in case of an error.
=item B<errstr>
This class method returns a string telling you what kind of error occured.
Currently, only use this method after the constructor C<new> failed to return a
new object.
=item B<wave_header> (length, [ MPC_LITTLE_ENDIAN || MPC_BIG_ENDIAN ])
Returns a wave file header suitable for I<length> bytes of data. The optional
lib/Audio/MPC.pm view on Meta::CPAN
sub my_get_size {
my $reader = shift;
return -s $reader->fh;
}
=item * canseek (reader)
The function is expected to return a true value if the underlying filehandle
is seekable. However, experiments showed that non-seekable streams cannot be
decoded and are therefore not handled at all:
sub canseek {
my $reader = shift;
return seek $reader->fh, 0, SEEK_CUR; # test if seek succeeded
}
=back
=head1 EXPORT
( run in 0.339 second using v1.01-cache-2.11-cpan-26ccb49234f )