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