1 /* $Id: rbaudio.c,v 1.3 2003-01-15 02:42:41 btb Exp $ */
4 * SDL CD Audio functions
23 static SDL_CD *s_cd = NULL;
24 extern int Redbook_playing;
25 static int initialised = 0;
37 if (initialised) return;
38 if (FindArg("-nocdrom")) return;
40 if (SDL_Init(SDL_INIT_CDROM) < 0)
42 Warning("SDL library initialisation failed: %s.",SDL_GetError());
46 if (SDL_CDNumDrives() == 0)
48 Warning("No cdrom drives found!\n");
53 Warning("Could not open cdrom for redbook audio!\n");
70 int RBAPlayTrack(int a)
72 if (!initialised) return -1;
74 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
75 SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0);
83 if (!initialised) return;
87 void RBASetVolume(int a)
94 if (!initialised) return;
100 if (!initialised) return -1;
105 int RBAGetNumberOfTracks()
107 if (!initialised) return -1;
109 return s_cd->numtracks;
112 int RBAPlayTracks(int tracknum,int something)
114 if (!initialised) return -1;
115 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
116 SDL_CDPlayTracks(s_cd, tracknum-1, 0, 0, 0);
123 if (!initialised) return -1;
125 return s_cd->cur_track;
128 int RBAPeekPlayStatus()
130 return (SDL_CDStatus(s_cd) == CD_PLAYING);