1SDL_CDStatus(3)                SDL API Reference               SDL_CDStatus(3)
2
3
4

NAME

6       SDL_CDStatus - Returns the current status of the given drive.
7

SYNOPSIS

9       #include "SDL.h"
10
11       CDstatus  SDL_CDStatus(SDL_CD  *cdrom); /* Given a status, returns true
12       if  there's  a  disk  in  the  drive  */   #define   CD_INDRIVE(status)
13       ((int)status > 0)
14

DESCRIPTION

16       This  function returns the current status of the given drive. Status is
17       described like so:
18
19       typedef enum {
20         CD_TRAYEMPTY,
21         CD_STOPPED,
22         CD_PLAYING,
23         CD_PAUSED,
24         CD_ERROR = -1
25       } CDstatus;
26
27       If the drive has a CD in it, the table of contents of the CD  and  cur‐
28       rent play position of the CD will be stored in the SDL_CD structure.
29
30       The  macro  CD_INDRIVE  is provided for convenience, and given a status
31       returns true if there's a disk in the drive.
32
33              Note:
34
35              SDL_CDStatus also updates the SDL_CD structure passed to it.
36

EXAMPLE

38       int playTrack(int track)
39       {
40         int playing = 0;
41
42         if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
43         /* clamp to the actual number of tracks on the CD */
44           if (track >= cdrom->numtracks) {
45             track = cdrom->numtracks-1;
46           }
47
48           if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
49             playing = 1;
50           }
51         }
52         return playing;
53       }
54

SEE ALSO

56       SDL_CD
57
58
59
60SDL                         Tue 11 Sep 2001, 22:58             SDL_CDStatus(3)
Impressum