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