Mercurial > sdl-ios-xcode
annotate include/SDL_cdrom.h @ 1768:814f9f2c7a33
Fixed bug #80
Date: 21 Apr 2003 17:20:20 +0100
From: Alan Swanson <swanson@uklinux.net>
Subject: [SDL] New XFree 4.3 Video Mode Patch
If you look at the unsorted list of modes returned by X, here's mine;
1280 x 1024 @ 85.0 >
1024 x 768 @ 100.3 > USER
800 x 600 @ 125.5 > SET
640 x 480 @ 124.9 >
1280 x 1024 @ 75.0 ]
1280 x 1024 @ 60.0 ]
1280 x 960 @ 85.0 ] X11
1280 x 960 @ 60.0 ] AUTO
1152 x 864 @ 75.0 ]=20
1152 x 768 @ 54.8 ]
960 x 720 @ 120.0 ]
...
640 x 400 @ 85.1 ] 256k
576 x 432 @ 150.0 ] 249k PIXEL
640 x 350 @ 85.1 ] 224k COUNT
576 x 384 @ 109.6 ] 221k
...
The user set modes come first followed by X set modes which are ordered
by decreasing number of pixels and refresh.
The reason why every other library or program not using SDL working is
due to SDL scanning the modes in reverse getting X11 provided modes
modes with the lowest refresh.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 05 May 2006 05:50:26 +0000 |
parents | c71e05b4dc2e |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 9 |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1046
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 18 |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 /* This is the CD-audio control API for Simple DirectMedia Layer */ | |
24 | |
25 #ifndef _SDL_cdrom_h | |
26 #define _SDL_cdrom_h | |
27 | |
1353
7ba544e2888d
Started the process of improving configure support, and merging C types
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
28 #include "SDL_stdinc.h" |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1356
diff
changeset
|
29 #include "SDL_error.h" |
0 | 30 |
31 #include "begin_code.h" | |
32 /* Set up for C function definitions, even when using C++ */ | |
33 #ifdef __cplusplus | |
34 extern "C" { | |
35 #endif | |
36 | |
37 /* In order to use these functions, SDL_Init() must have been called | |
38 with the SDL_INIT_CDROM flag. This causes SDL to scan the system | |
39 for CD-ROM drives, and load appropriate drivers. | |
40 */ | |
41 | |
42 /* The maximum number of CD-ROM tracks on a disk */ | |
43 #define SDL_MAX_TRACKS 99 | |
44 | |
45 /* The types of CD-ROM track possible */ | |
46 #define SDL_AUDIO_TRACK 0x00 | |
47 #define SDL_DATA_TRACK 0x04 | |
48 | |
49 /* The possible states which a CD-ROM drive can be in. */ | |
50 typedef enum { | |
51 CD_TRAYEMPTY, | |
52 CD_STOPPED, | |
53 CD_PLAYING, | |
54 CD_PAUSED, | |
55 CD_ERROR = -1 | |
56 } CDstatus; | |
57 | |
58 /* Given a status, returns true if there's a disk in the drive */ | |
1046
f09d5edfc7a3
Added some parentheses for a little more macro safety. Recommended by Petri
Ryan C. Gordon <icculus@icculus.org>
parents:
911
diff
changeset
|
59 #define CD_INDRIVE(status) ((int)(status) > 0) |
0 | 60 |
911
04a403e4ccf5
Date: Mon, 3 May 2004 03:15:01 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
61 typedef struct SDL_CDtrack { |
0 | 62 Uint8 id; /* Track number */ |
63 Uint8 type; /* Data or audio track */ | |
64 Uint16 unused; | |
65 Uint32 length; /* Length, in frames, of this track */ | |
66 Uint32 offset; /* Offset, in frames, from start of disk */ | |
67 } SDL_CDtrack; | |
68 | |
69 /* This structure is only current as of the last call to SDL_CDStatus() */ | |
70 typedef struct SDL_CD { | |
71 int id; /* Private drive identifier */ | |
72 CDstatus status; /* Current drive status */ | |
73 | |
74 /* The rest of this structure is only valid if there's a CD in drive */ | |
75 int numtracks; /* Number of tracks on disk */ | |
76 int cur_track; /* Current track position */ | |
77 int cur_frame; /* Current frame offset within current track */ | |
78 SDL_CDtrack track[SDL_MAX_TRACKS+1]; | |
79 } SDL_CD; | |
80 | |
81 /* Conversion functions from frames to Minute/Second/Frames and vice versa */ | |
82 #define CD_FPS 75 | |
83 #define FRAMES_TO_MSF(f, M,S,F) { \ | |
84 int value = f; \ | |
85 *(F) = value%CD_FPS; \ | |
86 value /= CD_FPS; \ | |
87 *(S) = value%60; \ | |
88 value /= 60; \ | |
89 *(M) = value; \ | |
90 } | |
91 #define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F)) | |
92 | |
93 /* CD-audio API functions: */ | |
94 | |
95 /* Returns the number of CD-ROM drives on the system, or -1 if | |
96 SDL_Init() has not been called with the SDL_INIT_CDROM flag. | |
97 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
98 extern DECLSPEC int SDLCALL SDL_CDNumDrives(void); |
0 | 99 |
100 /* Returns a human-readable, system-dependent identifier for the CD-ROM. | |
101 Example: | |
102 "/dev/cdrom" | |
103 "E:" | |
104 "/dev/disk/ide/1/master" | |
105 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
106 extern DECLSPEC const char * SDLCALL SDL_CDName(int drive); |
0 | 107 |
108 /* Opens a CD-ROM drive for access. It returns a drive handle on success, | |
109 or NULL if the drive was invalid or busy. This newly opened CD-ROM | |
110 becomes the default CD used when other CD functions are passed a NULL | |
111 CD-ROM handle. | |
112 Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. | |
113 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
114 extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive); |
0 | 115 |
116 /* This function returns the current status of the given drive. | |
117 If the drive has a CD in it, the table of contents of the CD and current | |
118 play position of the CD will be stored in the SDL_CD structure. | |
119 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
120 extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom); |
0 | 121 |
122 /* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' | |
123 tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play | |
124 until the end of the CD. This function will skip data tracks. | |
125 This function should only be called after calling SDL_CDStatus() to | |
126 get track information about the CD. | |
127 For example: | |
128 // Play entire CD: | |
129 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) | |
130 SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); | |
131 // Play last track: | |
132 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { | |
133 SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); | |
134 } | |
135 // Play first and second track and 10 seconds of third track: | |
136 if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) | |
137 SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); | |
138 | |
139 This function returns 0, or -1 if there was an error. | |
140 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
141 extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom, |
0 | 142 int start_track, int start_frame, int ntracks, int nframes); |
143 | |
144 /* Play the given CD starting at 'start' frame for 'length' frames. | |
145 It returns 0, or -1 if there was an error. | |
146 */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
147 extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length); |
0 | 148 |
149 /* Pause play -- returns 0, or -1 on error */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
150 extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom); |
0 | 151 |
152 /* Resume play -- returns 0, or -1 on error */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
153 extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom); |
0 | 154 |
155 /* Stop play -- returns 0, or -1 on error */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
156 extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom); |
0 | 157 |
158 /* Eject CD-ROM -- returns 0, or -1 on error */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
159 extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom); |
0 | 160 |
161 /* Closes the handle for the CD-ROM drive */ | |
337
9154ec9ca3d2
Explicitly specify the SDL API calling convention (C by default)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
162 extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom); |
0 | 163 |
164 | |
165 /* Ends C function definitions when using C++ */ | |
166 #ifdef __cplusplus | |
167 } | |
168 #endif | |
169 #include "close_code.h" | |
170 | |
171 #endif /* _SDL_video_h */ |