]> icculus.org git repositories - btb/d2x.git/blob - sound/sdl_cdrom.c
unification of input headers
[btb/d2x.git] / sound / sdl_cdrom.c
1 /* DPH: This is the file where all the stub functions go. The aim is to have nothing in here ,eventually */
2 #include <conf.h>
3
4 #ifdef SDL_AUDIO
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <SDL/SDL.h>
8 #include <SDL/SDL_cdrom.h>
9 #include "pstypes.h"
10 #include "error.h"
11 #include "args.h"
12
13
14 static SDL_CD *s_cd = NULL;
15 extern int Redbook_playing;
16 static int initialised = 0;
17
18 void RBAExit()
19 {
20   if (initialised)
21   {
22         SDL_CDClose(s_cd);
23   }
24 }
25
26 void RBAInit()
27 {
28         if (initialised) return;
29         if (FindArg("-nocdrom")) return; 
30
31         if (SDL_Init(SDL_INIT_CDROM) < 0)
32         {
33                 Warning("SDL library initialisation failed: %s.",SDL_GetError());
34                 return;
35         }
36
37         if (SDL_CDNumDrives() == 0)
38         {
39                 Warning("No cdrom drives found!\n");
40                 return;
41         }
42         s_cd = SDL_CDOpen(0);
43         atexit(RBAExit);
44         initialised = 1;
45 }
46
47 int RBAEnabled()
48 {
49  return 1;
50 }
51
52 void RBARegisterCD()
53 {
54
55 }
56
57 int RBAPlayTrack(int a)
58 {
59  if (!initialised) return -1;
60
61  if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
62          SDL_CDPlayTracks(s_cd, a-1, 0, 0, 0);
63  }
64  return a;
65  
66 }
67
68 void RBAStop()
69 {
70   if (!initialised) return;
71   SDL_CDStop(s_cd);
72 }
73
74 void RBASetVolume(int a)
75 {
76
77 }
78
79 void RBAPause()
80 {
81   if (!initialised) return;
82   SDL_CDPause(s_cd);
83 }
84
85 void RBAResume()
86 {
87   if (!initialised) return;
88   SDL_CDResume(s_cd);
89 }
90
91 int RBAGetNumberOfTracks()
92 {
93   if (!initialised) return -1;
94  SDL_CDStatus(s_cd);
95  return s_cd->numtracks;
96 }
97
98 int RBAPlayTracks(int tracknum,int something)
99 {
100   if (!initialised) return -1;
101  if (CD_INDRIVE(SDL_CDStatus(s_cd)) ) {
102          SDL_CDPlayTracks(s_cd, tracknum-1, 0, 0, 0);
103  }
104  return tracknum;
105 }
106
107 int RBAGetTrackNum()
108 {
109   if (!initialised) return -1;
110  SDL_CDStatus(s_cd);
111  return s_cd->cur_track;
112 }
113
114 int RBAPeekPlayStatus()
115 {
116  return 1;
117 }
118
119 int CD_blast_mixer()
120 {
121  return 0;
122 }
123
124 #endif //SDL_AUDIO