1 /* $Id: rbaudio.c,v 1.4 2003-03-15 01:28:19 btb Exp $ */
4 * SDL CD Audio functions
23 static SDL_CD *s_cd = NULL;
24 extern int Redbook_playing;
25 static int initialised = 0;
38 if (initialised) return;
39 if (FindArg("-nocdrom")) return;
41 if (SDL_Init(SDL_INIT_CDROM) < 0)
43 Warning("SDL library initialisation failed: %s.",SDL_GetError());
47 if (SDL_CDNumDrives() == 0)
49 Warning("No cdrom drives found!\n");
54 Warning("Could not open cdrom for redbook audio!\n");
71 int RBAPlayTrack(int a)
73 if (!initialised) return -1;
75 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
76 SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0);
84 if (!initialised) return;
88 void RBASetVolume(int a)
95 if (!initialised) return;
101 if (!initialised) return -1;
106 int RBAGetNumberOfTracks()
108 if (!initialised) return -1;
110 return s_cd->numtracks;
113 int RBAPlayTracks(int tracknum,int something)
115 if (!initialised) return -1;
116 if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
117 SDL_CDPlayTracks(s_cd, tracknum-1, 0, 0, 0);
124 if (!initialised) return -1;
126 return s_cd->cur_track;
129 int RBAPeekPlayStatus()
131 return (SDL_CDStatus(s_cd) == CD_PLAYING);