comparison src/audio/disk/SDL_diskaudio.c @ 3816:9d070c1a45fa SDL-ryan-multiple-audio-device

Moved AudioBootstrap section in converted drivers to bottom of source, so I could delete the predeclarations (one more thing to forget to update when changing the API, otherwise). There're a few other cleanups that snuck into this commit, too.
author Ryan C. Gordon <icculus@icculus.org>
date Fri, 06 Oct 2006 04:46:58 +0000
parents 7852b5b78af5
children 66fb40445587
comparison
equal deleted inserted replaced
3815:3234d6eee011 3816:9d070c1a45fa
43 #define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE" 43 #define DISKENVR_OUTFILE "SDL_DISKAUDIOFILE"
44 #define DISKDEFAULT_OUTFILE "sdlaudio.raw" 44 #define DISKDEFAULT_OUTFILE "sdlaudio.raw"
45 #define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY" 45 #define DISKENVR_WRITEDELAY "SDL_DISKAUDIODELAY"
46 #define DISKDEFAULT_WRITEDELAY 150 46 #define DISKDEFAULT_WRITEDELAY 150
47 47
48 /* Audio driver functions */
49 static int DISKAUD_OpenDevice(_THIS, const char *devname, int iscapture);
50 static void DISKAUD_WaitDevice(_THIS);
51 static void DISKAUD_PlayDevice(_THIS);
52 static Uint8 *DISKAUD_GetDeviceBuf(_THIS);
53 static void DISKAUD_CloseDevice(_THIS);
54
55 static const char * 48 static const char *
56 DISKAUD_GetOutputFilename(const char *devname) 49 DISKAUD_GetOutputFilename(const char *devname)
57 { 50 {
58 if (devname == NULL) { 51 if (devname == NULL) {
59 devname = SDL_getenv(DISKENVR_OUTFILE); 52 devname = SDL_getenv(DISKENVR_OUTFILE);
68 static int 61 static int
69 DISKAUD_Available(void) 62 DISKAUD_Available(void)
70 { 63 {
71 return 1; /* always available. */ 64 return 1; /* always available. */
72 } 65 }
73
74 static int
75 DISKAUD_Init(SDL_AudioDriverImpl *impl)
76 {
77 /* Initialize all variables that we clean on shutdown */
78 SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl));
79
80 /* Set the function pointers */
81 impl->OpenDevice = DISKAUD_OpenDevice;
82 impl->WaitDevice = DISKAUD_WaitDevice;
83 impl->PlayDevice = DISKAUD_PlayDevice;
84 impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
85 impl->CloseDevice = DISKAUD_CloseDevice;
86
87 return 1;
88 }
89
90 AudioBootStrap DISKAUD_bootstrap = {
91 DISKAUD_DRIVER_NAME, "direct-to-disk audio",
92 DISKAUD_Available, DISKAUD_Init, 1
93 };
94 66
95 /* This function waits until it is possible to write a full sound buffer */ 67 /* This function waits until it is possible to write a full sound buffer */
96 static void 68 static void
97 DISKAUD_WaitDevice(_THIS) 69 DISKAUD_WaitDevice(_THIS)
98 { 70 {
181 153
182 /* We're ready to rock and roll. :-) */ 154 /* We're ready to rock and roll. :-) */
183 return 1; 155 return 1;
184 } 156 }
185 157
158 static int
159 DISKAUD_Init(SDL_AudioDriverImpl *impl)
160 {
161 /* Initialize all variables that we clean on shutdown */
162 SDL_memset(impl, '\0', sizeof (SDL_AudioDriverImpl));
163
164 /* Set the function pointers */
165 impl->OpenDevice = DISKAUD_OpenDevice;
166 impl->WaitDevice = DISKAUD_WaitDevice;
167 impl->PlayDevice = DISKAUD_PlayDevice;
168 impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
169 impl->CloseDevice = DISKAUD_CloseDevice;
170
171 return 1;
172 }
173
174 AudioBootStrap DISKAUD_bootstrap = {
175 DISKAUD_DRIVER_NAME, "direct-to-disk audio",
176 DISKAUD_Available, DISKAUD_Init, 1
177 };
178
186 /* vi: set ts=4 sw=4 expandtab: */ 179 /* vi: set ts=4 sw=4 expandtab: */