1 /* $Id: rbaudio.c,v 1.2 2002-08-04 23:19:37 btb Exp $ */
4 * SDL CD Audio functions
15 #include <SDL/SDL_cdrom.h>
21 static SDL_CD *s_cd = NULL;
22 extern int Redbook_playing;
23 static int initialised = 0;
35 if (initialised) return;
36 if (FindArg("-nocdrom")) return;
38 if (SDL_Init(SDL_INIT_CDROM) < 0)
40 Warning("SDL library initialisation failed: %s.",SDL_GetError());
44 if (SDL_CDNumDrives() == 0)
46 Warning("No cdrom drives found!\n");
51 Warning("Could not open cdrom for redbook audio!\n");
68 int RBAPlayTrack(int a)
70 if (!initialised) return -1;
72 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
73 SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0);
81 if (!initialised) return;
85 void RBASetVolume(int a)
92 if (!initialised) return;
98 if (!initialised) return -1;
103 int RBAGetNumberOfTracks()
105 if (!initialised) return -1;
107 return s_cd->numtracks;
110 int RBAPlayTracks(int tracknum,int something)
112 if (!initialised) return -1;
113 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
114 SDL_CDPlayTracks(s_cd, tracknum-1, 0, 0, 0);
121 if (!initialised) return -1;
123 return s_cd->cur_track;
126 int RBAPeekPlayStatus()
128 return (SDL_CDStatus(s_cd) == CD_PLAYING);