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