5 # Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
7 # ------------------------------------------------------------------------------
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 # ------------------------------------------------------------------------------
25 # Please feel free to send questions, suggestions or improvements to:
36 use vars qw(@ISA @EXPORT);
38 @EXPORT = qw/ &CD_NUM_DRIVES /;
43 my $class = ref($proto) || $proto;
46 $self = \SDL::CDOpen($number);
47 die SDL::GetError() if ( SDL::CD_ERROR() eq SDL::CDStatus($$self));
58 return SDL::CDNumDrives();
63 return SDL::CDName($$self);
68 return SDL::CDstatus($$self);
72 my ($self,$start,$length,$fs,$fl) = @_;
73 return SDL::CDPlayTracks($$self,$start,$length,$fs,$fl);
78 return SDL::CDPause($$self);
83 return SDL::CDResume($$self);
88 return SDL::CDStop($$self);
93 return SDL::CDEject($$self);
98 return SDL::CDId($$self);
103 return SDL::CDNumTracks($$self);
106 my $buildtrack = sub {
109 $track{-id} = SDL::CDTrackId($ptr);
110 $track{-type} = SDL::CDTrackType($ptr);
111 $track{-length} = SDL::CDTrackLength($ptr);
112 $track{-offset} = SDL::CDTrackOffset($ptr);
119 return &$buildtrack(SDL::CDTrack($$self,$number));
124 return $self->track(SDL::CDCurTrack($$self));
129 return SDL::CDCurFrame($$self);
142 SDL::Cdrom - a SDL perl extension for managing CD-ROM drives
147 $cdrom = SDL::Cdrom->new(0);
162 Create a new SDL::Cdrom object. The passed $id is the number of the drive,
163 whereas 0 is the first drive etc.
166 my $drive => SDL::Cdrom->new($id);
170 =head2 CD_NUM_DRIVES()
172 Returns the number of CD-ROM drives present.
176 Returns the system dependent name of the CD-ROM device.
180 Return the status of the drive.
200 Eject the medium in the drive.
204 Return the ID of the drive.
208 Return the number of tracks on the medium.
212 Returns the track description
216 Return the current played track number.
218 =head2 current_frame()
220 Return the current frame.
225 Documentation by Tels <http://bloodgate.com/>.
229 L<perl> L<SDL::Mixer> L<SDL::App>.