1
2=pod
3
4=head1 NAME
5
6SDL::CD -- SDL Bindings for structure SDL_CD
7
8=head1 CATEGORY
9
10Core, CDROM, Structure
11
12=head1 SYNOPSIS
13
14 use SDL;
15 use SDL::CDROM;
16 use SDL::CD;
17
18 SDL::init(SDL_INIT_CDROM);
19
20 my $drives = SDL::CDROM::num_drives;
21
22 if( $drives > 0 )
23 {
24  my $CD = SDL::CD->new( 0 );
25
26   if($CD)
27   {
28	...
29   }
30
31 }
32
33=head1 CONSTANTS
34
35The constants are exported by default. You can avoid this by doing:
36
37 use SDL::CD ();
38
39and access them directly:
40
41 SDL::CD::CD_TRAYEMPTY;
42
43or by choosing the export tags below:
44
45Export tag: ':status'
46
47 CD_TRAYEMPTY
48 CD_STOPPED
49 CD_PLAYING
50 CD_PAUSED
51 CD_ERROR
52
53Export tag: ':defaults'
54
55 CD_FPS
56 SDL_MAX_TRACKS
57
58=head1 METHOD
59
60=head2 new
61
62 my $CD = SDL::CD->new($drive)
63
64Makes a new SDL::CD object. Returns C<undef> if the drive is busy or inaccessible.
65
66=head2 status
67
68 my $status = $CD->status();
69
70Returns the current status of the CD tray
71
72Returns on of the following constants:
73
74=over
75
76=item *
77
78CD_TRAYEMPTY
79
80=item *
81
82CD_STOPPED
83
84=item *
85
86CD_PLAYING
87
88=item *
89
90CD_PAUSED
91
92=item *
93
94CD_ERROR
95
96=back
97
98=head2 play_tracks
99
100 $CD->play_tracks($start_track, $start_frame, $ntracks, $nframes)
101
102Plays the given SDL::CD starting at track $start_track, for $ntracks tracks.
103
104$start_frame is the frame offset, from the beginning of the $start_track, at which to start. $nframes is the frame offset, from the
105beginning of the last track ($start_track+$ntracks), at which to end playing.
106
107play_tracks() should only be called after calling L</status> to get information about the CD.
108
109B<Note: Data tracks are ignored.>
110
111Returns C<0>, or C<-1> if there was an error.
112
113=head2 play
114
115 $CD->play($start, $length);
116
117Plays the given SDL::CD , starting a frame $start for $length frames.
118
119Returns C<0> on success, C<-1> on error
120
121=head2 pause
122
123 $CD->pause();
124
125Pauses play on CD
126
127Returns C<0> on success, or C<-1> on an error.
128
129=head2 resume
130
131 $CD->resume();
132
133Returns C<0> on success, or C<-1> on an error.
134
135=head2 stop
136
137 $CD->stop();
138
139Stops play on the CD.
140
141Returns C<0> on success, or C<-1> on an error.
142
143=head2 eject
144
145 $CD->eject();
146
147Ejects the CD.
148
149Returns C<0> on success, or C<-1> on an error.
150
151=head2 id
152
153 $CD->id();
154
155Private drive identifier
156
157=head2 num_tracks
158
159 $CD->num_tracks();
160
161Number of tracks on the CD
162
163=head2 cur_track
164
165 $CD->cur_track();
166
167Current track on the CD;
168
169=head2 track
170
171 my $track =  $CD->track($number);
172
173Retrieves track description of track $number in CD. See L<SDL::CDTrack>.
174
175=head2 FRAMES_TO_MSF
176
177 my ($min, $sec, $fra) = FRAMES_TO_MSF($frames);
178
179Conversion functions from frames to Minute/Second/Frames
180
181=head2 MSF_TO_FRAMES
182
183 my $frames = MSF_TO_FRAMES($min, $sec, $fra);
184
185=head1 SEE ALSO
186
187L<SDL::CDROM>, L<SDL::CDTrack>
188
189=head1 AUTHORS
190
191See L<SDL/AUTHORS>.
192
193=cut
194