Audio::CD - Perl interface to libcdaudio (cd + cddb)
use Audio::CD (); my $cd = Audio::CD->init;
Audio::CD provides a Perl interface to libcdaudio by Tony Arcieri, available from http://cdcd.undergrid.net/
Several classes provide glue for the libcdaudio functions and data structures.
Initialize the Audio::CD object:
my $cd = Audio::CD->init;
Stat the Audio::CD object, returns an Audio::CD::Info object.
my $info = $cd->stat;
Returns an Audio::CDDB object.
my $cddb = $cd->cddb;
Play the given cd track (defaults to 1).
$cd->play(1);
Stop the cd.
$cd->stop;
Pause the cd.
$cd->pause;
Resume the cd.
$cd->resume;
Eject the cd.
$cd->eject;
Close the cd tray.
$cd->close;
$cd->play_frames($startframe, $endframe);
$cd->play_track_pos($strarttrack, $endtrack, $startpos);
$cd->play_track($strarttrack, $endtrack);
$cd->track_advance($endtrack, $minutes, $seconds);
$cd->advance($minutes, $seconds);
Returns an Audio::CD::Volume object.
my $vol = $cd->get_volume;
$cd->set_volume($vol);
my $id = $cddb->discid;
Does a cddb lookup and returns an Audio::CD::Data object.
my $data = $cddb->lookup;
my $artist = $data->artist;
my $title = $data->title;
my $genre = $data->genre;
Returns an array reference of Audio::CD::Track objects.
my $name = $track->name;
Returns the CD mode, one of PLAYING, PAUSED, COMPLETED, NOSTATUS;
my $track = $info->mode; print "playing" if $info->mode == Audio::CD::PLAYING;
Returns the total number of tracks on the cd.
my $track = $info->total_tracks;
Returns the current track play time:
my($minutes, $seconds) = $info->track_time;
Returns the current disc play time:
my($minutes, $seconds) = $info->time;
Returns the disc length time:
my($minutes, $seconds) = $info->length;
Returns an array reference of Audio::CD::Info::Track objects.
Returns the track length time:
my($minutes, $seconds) = $tinfo->length;
Returns the track position on the CD:
my($minutes, $seconds) = $tinfo->pos;
Returns the track type (either TRACK_AUDIO or TRACK_DATA):
if ($tinfo->type == Audio::CD::TRACK_AUDIO) { print "audio track\n"; } elsif ($tinfo->type == Audio::CD::TRACK_DATA) { print "data track\n"; }
Returns true if the track is an audio track; equivalent to the test:
$tinfo->type == Audio::CD::TRACK_AUDIO ? 1 : 0
Returns true if the track is a data track; equivalent to the test:
$tinfo->type == Audio::CD::TRACK_DATA ? 1 : 0
Xmms(3)
Perl interface by Doug MacEachern
libcdaudio and cddb_lookup.c by Tony Arcieri
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install Audio::CD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Audio::CD
CPAN shell
perl -MCPAN -e shell install Audio::CD
For more information on module installation, please visit the detailed CPAN module installation guide.