1 /* $Id: rbaudio.c,v 1.1 2002-07-18 08:22:18 bradleyb 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");
64 int RBAPlayTrack(int a)
66 if (!initialised) return -1;
68 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
69 SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0);
77 if (!initialised) return;
81 void RBASetVolume(int a)
88 if (!initialised) return;
94 if (!initialised) return -1;
99 int RBAGetNumberOfTracks()
101 if (!initialised) return -1;
103 return s_cd->numtracks;
106 int RBAPlayTracks(int tracknum,int something)
108 if (!initialised) return -1;
109 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
110 SDL_CDPlayTracks(s_cd, tracknum-1, 0, 0, 0);
117 if (!initialised) return -1;
119 return s_cd->cur_track;
122 int RBAPeekPlayStatus()
124 return (SDL_CDStatus(s_cd) == CD_PLAYING);