comparison src/audio/mint/SDL_mintaudio_mcsn.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
64 static unsigned long cookie_snd, cookie_mch; 64 static unsigned long cookie_snd, cookie_mch;
65 static cookie_mcsn_t *cookie_mcsn; 65 static cookie_mcsn_t *cookie_mcsn;
66 66
67 /*--- Audio driver functions ---*/ 67 /*--- Audio driver functions ---*/
68 68
69 static void Mint_CloseAudio (_THIS); 69 static void Mint_CloseAudio(_THIS);
70 static int Mint_OpenAudio (_THIS, SDL_AudioSpec * spec); 70 static int Mint_OpenAudio(_THIS, SDL_AudioSpec * spec);
71 static void Mint_LockAudio (_THIS); 71 static void Mint_LockAudio(_THIS);
72 static void Mint_UnlockAudio (_THIS); 72 static void Mint_UnlockAudio(_THIS);
73 73
74 /* To check/init hardware audio */ 74 /* To check/init hardware audio */
75 static int Mint_CheckAudio (_THIS, SDL_AudioSpec * spec); 75 static int Mint_CheckAudio(_THIS, SDL_AudioSpec * spec);
76 static void Mint_InitAudio (_THIS, SDL_AudioSpec * spec); 76 static void Mint_InitAudio(_THIS, SDL_AudioSpec * spec);
77 77
78 /*--- Audio driver bootstrap functions ---*/ 78 /*--- Audio driver bootstrap functions ---*/
79 79
80 static int 80 static int
81 Audio_Available (void) 81 Audio_Available(void)
82 { 82 {
83 unsigned long dummy; 83 unsigned long dummy;
84 const char *envr = SDL_getenv ("SDL_AUDIODRIVER"); 84 const char *envr = SDL_getenv("SDL_AUDIODRIVER");
85 85
86 SDL_MintAudio_mint_present = (Getcookie (C_MiNT, &dummy) == C_FOUND); 86 SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
87 87
88 /* We can't use XBIOS in interrupt with Magic, don't know about thread */ 88 /* We can't use XBIOS in interrupt with Magic, don't know about thread */
89 if (Getcookie (C_MagX, &dummy) == C_FOUND) { 89 if (Getcookie(C_MagX, &dummy) == C_FOUND) {
90 return (0); 90 return (0);
91 } 91 }
92 92
93 /* Check if user asked a different audio driver */ 93 /* Check if user asked a different audio driver */
94 if ((envr) && (SDL_strcmp (envr, MINT_AUDIO_DRIVER_NAME) != 0)) { 94 if ((envr) && (SDL_strcmp(envr, MINT_AUDIO_DRIVER_NAME) != 0)) {
95 DEBUG_PRINT ((DEBUG_NAME "user asked a different audio driver\n")); 95 DEBUG_PRINT((DEBUG_NAME "user asked a different audio driver\n"));
96 return (0); 96 return (0);
97 } 97 }
98 98
99 /* Cookie _MCH present ? if not, assume ST machine */ 99 /* Cookie _MCH present ? if not, assume ST machine */
100 if (Getcookie (C__MCH, &cookie_mch) == C_NOTFOUND) { 100 if (Getcookie(C__MCH, &cookie_mch) == C_NOTFOUND) {
101 cookie_mch = MCH_ST; 101 cookie_mch = MCH_ST;
102 } 102 }
103 103
104 /* Cookie _SND present ? if not, assume ST machine */ 104 /* Cookie _SND present ? if not, assume ST machine */
105 if (Getcookie (C__SND, &cookie_snd) == C_NOTFOUND) { 105 if (Getcookie(C__SND, &cookie_snd) == C_NOTFOUND) {
106 cookie_snd = SND_PSG; 106 cookie_snd = SND_PSG;
107 } 107 }
108 108
109 /* Check if we have 16 bits audio */ 109 /* Check if we have 16 bits audio */
110 if ((cookie_snd & SND_16BIT) == 0) { 110 if ((cookie_snd & SND_16BIT) == 0) {
111 DEBUG_PRINT ((DEBUG_NAME "no 16 bits sound\n")); 111 DEBUG_PRINT((DEBUG_NAME "no 16 bits sound\n"));
112 return (0); 112 return (0);
113 } 113 }
114 114
115 /* Cookie MCSN present ? */ 115 /* Cookie MCSN present ? */
116 if (Getcookie (C_McSn, (long *) &cookie_mcsn) != C_FOUND) { 116 if (Getcookie(C_McSn, (long *) &cookie_mcsn) != C_FOUND) {
117 DEBUG_PRINT ((DEBUG_NAME "no MCSN audio\n")); 117 DEBUG_PRINT((DEBUG_NAME "no MCSN audio\n"));
118 return (0); 118 return (0);
119 } 119 }
120 120
121 /* Check if interrupt at end of replay */ 121 /* Check if interrupt at end of replay */
122 if (cookie_mcsn->pint == 0) { 122 if (cookie_mcsn->pint == 0) {
123 DEBUG_PRINT ((DEBUG_NAME "no interrupt at end of replay\n")); 123 DEBUG_PRINT((DEBUG_NAME "no interrupt at end of replay\n"));
124 return (0); 124 return (0);
125 } 125 }
126 126
127 /* Check if audio is lockable */ 127 /* Check if audio is lockable */
128 if (Locksnd () != 1) { 128 if (Locksnd() != 1) {
129 DEBUG_PRINT ((DEBUG_NAME "audio locked by other application\n")); 129 DEBUG_PRINT((DEBUG_NAME "audio locked by other application\n"));
130 return (0); 130 return (0);
131 } 131 }
132 132
133 Unlocksnd (); 133 Unlocksnd();
134 134
135 DEBUG_PRINT ((DEBUG_NAME "MCSN audio available!\n")); 135 DEBUG_PRINT((DEBUG_NAME "MCSN audio available!\n"));
136 return (1); 136 return (1);
137 } 137 }
138 138
139 static void 139 static void
140 Audio_DeleteDevice (SDL_AudioDevice * device) 140 Audio_DeleteDevice(SDL_AudioDevice * device)
141 { 141 {
142 SDL_free (device->hidden); 142 SDL_free(device->hidden);
143 SDL_free (device); 143 SDL_free(device);
144 } 144 }
145 145
146 static SDL_AudioDevice * 146 static SDL_AudioDevice *
147 Audio_CreateDevice (int devindex) 147 Audio_CreateDevice(int devindex)
148 { 148 {
149 SDL_AudioDevice *this; 149 SDL_AudioDevice *this;
150 150
151 /* Initialize all variables that we clean on shutdown */ 151 /* Initialize all variables that we clean on shutdown */
152 this = (SDL_AudioDevice *) SDL_malloc (sizeof (SDL_AudioDevice)); 152 this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
153 if (this) { 153 if (this) {
154 SDL_memset (this, 0, (sizeof *this)); 154 SDL_memset(this, 0, (sizeof *this));
155 this->hidden = (struct SDL_PrivateAudioData *) 155 this->hidden = (struct SDL_PrivateAudioData *)
156 SDL_malloc ((sizeof *this->hidden)); 156 SDL_malloc((sizeof *this->hidden));
157 } 157 }
158 if ((this == NULL) || (this->hidden == NULL)) { 158 if ((this == NULL) || (this->hidden == NULL)) {
159 SDL_OutOfMemory (); 159 SDL_OutOfMemory();
160 if (this) { 160 if (this) {
161 SDL_free (this); 161 SDL_free(this);
162 } 162 }
163 return (0); 163 return (0);
164 } 164 }
165 SDL_memset (this->hidden, 0, (sizeof *this->hidden)); 165 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
166 166
167 /* Set the function pointers */ 167 /* Set the function pointers */
168 this->OpenAudio = Mint_OpenAudio; 168 this->OpenAudio = Mint_OpenAudio;
169 this->CloseAudio = Mint_CloseAudio; 169 this->CloseAudio = Mint_CloseAudio;
170 this->LockAudio = Mint_LockAudio; 170 this->LockAudio = Mint_LockAudio;
178 MINT_AUDIO_DRIVER_NAME, "MiNT MCSN audio driver", 178 MINT_AUDIO_DRIVER_NAME, "MiNT MCSN audio driver",
179 Audio_Available, Audio_CreateDevice 179 Audio_Available, Audio_CreateDevice
180 }; 180 };
181 181
182 static void 182 static void
183 Mint_LockAudio (_THIS) 183 Mint_LockAudio(_THIS)
184 { 184 {
185 /* Stop replay */ 185 /* Stop replay */
186 Buffoper (0); 186 Buffoper(0);
187 } 187 }
188 188
189 static void 189 static void
190 Mint_UnlockAudio (_THIS) 190 Mint_UnlockAudio(_THIS)
191 { 191 {
192 /* Restart replay */ 192 /* Restart replay */
193 Buffoper (SB_PLA_ENA | SB_PLA_RPT); 193 Buffoper(SB_PLA_ENA | SB_PLA_RPT);
194 } 194 }
195 195
196 static void 196 static void
197 Mint_CloseAudio (_THIS) 197 Mint_CloseAudio(_THIS)
198 { 198 {
199 /* Stop replay */ 199 /* Stop replay */
200 SDL_MintAudio_WaitThread (); 200 SDL_MintAudio_WaitThread();
201 Buffoper (0); 201 Buffoper(0);
202 202
203 if (!SDL_MintAudio_mint_present) { 203 if (!SDL_MintAudio_mint_present) {
204 /* Uninstall interrupt */ 204 /* Uninstall interrupt */
205 Jdisint (MFP_DMASOUND); 205 Jdisint(MFP_DMASOUND);
206 } 206 }
207 207
208 /* Wait if currently playing sound */ 208 /* Wait if currently playing sound */
209 while (SDL_MintAudio_mutex != 0) { 209 while (SDL_MintAudio_mutex != 0) {
210 } 210 }
211 211
212 /* Clear buffers */ 212 /* Clear buffers */
213 if (SDL_MintAudio_audiobuf[0]) { 213 if (SDL_MintAudio_audiobuf[0]) {
214 Mfree (SDL_MintAudio_audiobuf[0]); 214 Mfree(SDL_MintAudio_audiobuf[0]);
215 SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL; 215 SDL_MintAudio_audiobuf[0] = SDL_MintAudio_audiobuf[1] = NULL;
216 } 216 }
217 217
218 /* Unlock sound system */ 218 /* Unlock sound system */
219 Unlocksnd (); 219 Unlocksnd();
220 } 220 }
221 221
222 static int 222 static int
223 Mint_CheckAudio (_THIS, SDL_AudioSpec * spec) 223 Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
224 { 224 {
225 int i; 225 int i;
226 unsigned long masterclock, masterprediv; 226 unsigned long masterclock, masterprediv;
227 227
228 DEBUG_PRINT ((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); 228 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff));
229 DEBUG_PRINT (("signed=%d, ", ((spec->format & 0x8000) != 0))); 229 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
230 DEBUG_PRINT (("big endian=%d, ", ((spec->format & 0x1000) != 0))); 230 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
231 DEBUG_PRINT (("channels=%d, ", spec->channels)); 231 DEBUG_PRINT(("channels=%d, ", spec->channels));
232 DEBUG_PRINT (("freq=%d\n", spec->freq)); 232 DEBUG_PRINT(("freq=%d\n", spec->freq));
233 233
234 /* Check formats available */ 234 /* Check formats available */
235 MINTAUDIO_freqcount = 0; 235 MINTAUDIO_freqcount = 0;
236 switch (cookie_mcsn->play) { 236 switch (cookie_mcsn->play) {
237 case MCSN_ST: 237 case MCSN_ST:
238 spec->channels = 1; 238 spec->channels = 1;
239 spec->format = 8; /* FIXME: is it signed or unsigned ? */ 239 spec->format = 8; /* FIXME: is it signed or unsigned ? */
240 SDL_MintAudio_AddFrequency (this, 12500, 0, 0, -1); 240 SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
241 break; 241 break;
242 case MCSN_TT: /* Also STE, Mega STE */ 242 case MCSN_TT: /* Also STE, Mega STE */
243 spec->format = AUDIO_S8; 243 spec->format = AUDIO_S8;
244 masterclock = MASTERCLOCK_STE; 244 masterclock = MASTERCLOCK_STE;
245 masterprediv = MASTERPREDIV_STE; 245 masterprediv = MASTERPREDIV_STE;
246 if ((cookie_mch >> 16) == MCH_TT) { 246 if ((cookie_mch >> 16) == MCH_TT) {
247 masterclock = MASTERCLOCK_TT; 247 masterclock = MASTERCLOCK_TT;
248 masterprediv = MASTERPREDIV_TT; 248 masterprediv = MASTERPREDIV_TT;
249 } 249 }
250 for (i = 0; i < 4; i++) { 250 for (i = 0; i < 4; i++) {
251 SDL_MintAudio_AddFrequency (this, 251 SDL_MintAudio_AddFrequency(this,
252 masterclock / (masterprediv * 252 masterclock / (masterprediv *
253 (1 << i)), 253 (1 << i)),
254 masterclock, 3 - i, -1); 254 masterclock, 3 - i, -1);
255 } 255 }
256 break; 256 break;
257 case MCSN_FALCON: /* Also Mac */ 257 case MCSN_FALCON: /* Also Mac */
258 for (i = 1; i < 12; i++) { 258 for (i = 1; i < 12; i++) {
259 /* Remove unusable Falcon codec predivisors */ 259 /* Remove unusable Falcon codec predivisors */
260 if ((i == 6) || (i == 8) || (i == 10)) { 260 if ((i == 6) || (i == 8) || (i == 10)) {
261 continue; 261 continue;
262 } 262 }
263 SDL_MintAudio_AddFrequency (this, 263 SDL_MintAudio_AddFrequency(this,
264 MASTERCLOCK_FALCON1 / 264 MASTERCLOCK_FALCON1 /
265 (MASTERPREDIV_FALCON * (i + 1)), 265 (MASTERPREDIV_FALCON * (i + 1)),
266 CLK25M, i + 1, -1); 266 CLK25M, i + 1, -1);
267 } 267 }
268 if (cookie_mcsn->res1 != 0) { 268 if (cookie_mcsn->res1 != 0) {
269 for (i = 1; i < 4; i++) { 269 for (i = 1; i < 4; i++) {
270 SDL_MintAudio_AddFrequency (this, 270 SDL_MintAudio_AddFrequency(this,
271 (cookie_mcsn->res1) / 271 (cookie_mcsn->res1) /
272 (MASTERPREDIV_FALCON * 272 (MASTERPREDIV_FALCON *
273 (1 << i)), CLKEXT, 273 (1 << i)), CLKEXT,
274 (1 << i) - 1, -1); 274 (1 << i) - 1, -1);
275 } 275 }
276 } 276 }
277 spec->format |= 0x8000; /* Audio is always signed */ 277 spec->format |= 0x8000; /* Audio is always signed */
278 if ((spec->format & 0x00ff) == 16) { 278 if ((spec->format & 0x00ff) == 16) {
279 spec->format |= 0x1000; /* Audio is always big endian */ 279 spec->format |= 0x1000; /* Audio is always big endian */
282 break; 282 break;
283 } 283 }
284 284
285 #if 1 285 #if 1
286 for (i = 0; i < MINTAUDIO_freqcount; i++) { 286 for (i = 0; i < MINTAUDIO_freqcount; i++) {
287 DEBUG_PRINT ((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n", 287 DEBUG_PRINT((DEBUG_NAME "freq %d: %lu Hz, clock %lu, prediv %d\n",
288 i, MINTAUDIO_frequencies[i].frequency, 288 i, MINTAUDIO_frequencies[i].frequency,
289 MINTAUDIO_frequencies[i].masterclock, 289 MINTAUDIO_frequencies[i].masterclock,
290 MINTAUDIO_frequencies[i].predivisor)); 290 MINTAUDIO_frequencies[i].predivisor));
291 } 291 }
292 #endif 292 #endif
293 293
294 MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency (this, spec->freq); 294 MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
295 spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; 295 spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
296 296
297 DEBUG_PRINT ((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); 297 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff));
298 DEBUG_PRINT (("signed=%d, ", ((spec->format & 0x8000) != 0))); 298 DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0)));
299 DEBUG_PRINT (("big endian=%d, ", ((spec->format & 0x1000) != 0))); 299 DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0)));
300 DEBUG_PRINT (("channels=%d, ", spec->channels)); 300 DEBUG_PRINT(("channels=%d, ", spec->channels));
301 DEBUG_PRINT (("freq=%d\n", spec->freq)); 301 DEBUG_PRINT(("freq=%d\n", spec->freq));
302 302
303 return 0; 303 return 0;
304 } 304 }
305 305
306 static void 306 static void
307 Mint_InitAudio (_THIS, SDL_AudioSpec * spec) 307 Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
308 { 308 {
309 int channels_mode, prediv, dmaclock; 309 int channels_mode, prediv, dmaclock;
310 void *buffer; 310 void *buffer;
311 311
312 /* Stop currently playing sound */ 312 /* Stop currently playing sound */
313 SDL_MintAudio_quit_thread = SDL_FALSE; 313 SDL_MintAudio_quit_thread = SDL_FALSE;
314 SDL_MintAudio_thread_finished = SDL_TRUE; 314 SDL_MintAudio_thread_finished = SDL_TRUE;
315 SDL_MintAudio_WaitThread (); 315 SDL_MintAudio_WaitThread();
316 Buffoper (0); 316 Buffoper(0);
317 317
318 /* Set replay tracks */ 318 /* Set replay tracks */
319 Settracks (0, 0); 319 Settracks(0, 0);
320 Setmontracks (0); 320 Setmontracks(0);
321 321
322 /* Select replay format */ 322 /* Select replay format */
323 channels_mode = STEREO16; 323 channels_mode = STEREO16;
324 switch (spec->format & 0xff) { 324 switch (spec->format & 0xff) {
325 case 8: 325 case 8:
328 } else { 328 } else {
329 channels_mode = MONO8; 329 channels_mode = MONO8;
330 } 330 }
331 break; 331 break;
332 } 332 }
333 if (Setmode (channels_mode) < 0) { 333 if (Setmode(channels_mode) < 0) {
334 DEBUG_PRINT ((DEBUG_NAME "Setmode() failed\n")); 334 DEBUG_PRINT((DEBUG_NAME "Setmode() failed\n"));
335 } 335 }
336 336
337 dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock; 337 dmaclock = MINTAUDIO_frequencies[MINTAUDIO_numfreq].masterclock;
338 prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; 338 prediv = MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
339 switch (cookie_mcsn->play) { 339 switch (cookie_mcsn->play) {
340 case MCSN_TT: 340 case MCSN_TT:
341 Devconnect (DMAPLAY, DAC, CLK25M, CLKOLD, 1); 341 Devconnect(DMAPLAY, DAC, CLK25M, CLKOLD, 1);
342 Soundcmd (SETPRESCALE, prediv); 342 Soundcmd(SETPRESCALE, prediv);
343 DEBUG_PRINT ((DEBUG_NAME "STE/TT prescaler selected\n")); 343 DEBUG_PRINT((DEBUG_NAME "STE/TT prescaler selected\n"));
344 break; 344 break;
345 case MCSN_FALCON: 345 case MCSN_FALCON:
346 Devconnect (DMAPLAY, DAC, dmaclock, prediv, 1); 346 Devconnect(DMAPLAY, DAC, dmaclock, prediv, 1);
347 DEBUG_PRINT ((DEBUG_NAME "Falcon prescaler selected\n")); 347 DEBUG_PRINT((DEBUG_NAME "Falcon prescaler selected\n"));
348 break; 348 break;
349 } 349 }
350 350
351 /* Set buffer */ 351 /* Set buffer */
352 buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf]; 352 buffer = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
353 if (Setbuffer (0, buffer, buffer + spec->size) < 0) { 353 if (Setbuffer(0, buffer, buffer + spec->size) < 0) {
354 DEBUG_PRINT ((DEBUG_NAME "Setbuffer() failed\n")); 354 DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
355 } 355 }
356 356
357 if (SDL_MintAudio_mint_present) { 357 if (SDL_MintAudio_mint_present) {
358 SDL_MintAudio_thread_pid = tfork (SDL_MintAudio_Thread, 0); 358 SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
359 } else { 359 } else {
360 /* Install interrupt */ 360 /* Install interrupt */
361 Jdisint (MFP_DMASOUND); 361 Jdisint(MFP_DMASOUND);
362 Xbtimer (XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); 362 Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);
363 Jenabint (MFP_DMASOUND); 363 Jenabint(MFP_DMASOUND);
364 364
365 if (Setinterrupt (SI_TIMERA, SI_PLAY) < 0) { 365 if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
366 DEBUG_PRINT ((DEBUG_NAME "Setinterrupt() failed\n")); 366 DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));
367 } 367 }
368 } 368 }
369 369
370 /* Go */ 370 /* Go */
371 Buffoper (SB_PLA_ENA | SB_PLA_RPT); 371 Buffoper(SB_PLA_ENA | SB_PLA_RPT);
372 DEBUG_PRINT ((DEBUG_NAME "hardware initialized\n")); 372 DEBUG_PRINT((DEBUG_NAME "hardware initialized\n"));
373 } 373 }
374 374
375 static int 375 static int
376 Mint_OpenAudio (_THIS, SDL_AudioSpec * spec) 376 Mint_OpenAudio(_THIS, SDL_AudioSpec * spec)
377 { 377 {
378 /* Lock sound system */ 378 /* Lock sound system */
379 if (Locksnd () != 1) { 379 if (Locksnd() != 1) {
380 SDL_SetError ("Mint_OpenAudio: Audio system already in use"); 380 SDL_SetError("Mint_OpenAudio: Audio system already in use");
381 return (-1); 381 return (-1);
382 } 382 }
383 383
384 SDL_MintAudio_device = this; 384 SDL_MintAudio_device = this;
385 385
386 /* Check audio capabilities */ 386 /* Check audio capabilities */
387 if (Mint_CheckAudio (this, spec) == -1) { 387 if (Mint_CheckAudio(this, spec) == -1) {
388 return -1; 388 return -1;
389 } 389 }
390 390
391 SDL_CalculateAudioSpec (spec); 391 SDL_CalculateAudioSpec(spec);
392 392
393 /* Allocate memory for audio buffers in DMA-able RAM */ 393 /* Allocate memory for audio buffers in DMA-able RAM */
394 DEBUG_PRINT ((DEBUG_NAME "buffer size=%d\n", spec->size)); 394 DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size));
395 395
396 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc (spec->size * 2, MX_STRAM); 396 SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size * 2, MX_STRAM);
397 if (SDL_MintAudio_audiobuf[0] == NULL) { 397 if (SDL_MintAudio_audiobuf[0] == NULL) {
398 SDL_SetError ("MINT_OpenAudio: Not enough memory for audio buffer"); 398 SDL_SetError("MINT_OpenAudio: Not enough memory for audio buffer");
399 return (-1); 399 return (-1);
400 } 400 }
401 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size; 401 SDL_MintAudio_audiobuf[1] = SDL_MintAudio_audiobuf[0] + spec->size;
402 SDL_MintAudio_numbuf = 0; 402 SDL_MintAudio_numbuf = 0;
403 SDL_memset (SDL_MintAudio_audiobuf[0], spec->silence, spec->size * 2); 403 SDL_memset(SDL_MintAudio_audiobuf[0], spec->silence, spec->size * 2);
404 SDL_MintAudio_audiosize = spec->size; 404 SDL_MintAudio_audiosize = spec->size;
405 SDL_MintAudio_mutex = 0; 405 SDL_MintAudio_mutex = 0;
406 406
407 DEBUG_PRINT ((DEBUG_NAME "buffer 0 at 0x%08x\n", 407 DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n",
408 SDL_MintAudio_audiobuf[0])); 408 SDL_MintAudio_audiobuf[0]));
409 DEBUG_PRINT ((DEBUG_NAME "buffer 1 at 0x%08x\n", 409 DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n",
410 SDL_MintAudio_audiobuf[1])); 410 SDL_MintAudio_audiobuf[1]));
411 411
412 /* Setup audio hardware */ 412 /* Setup audio hardware */
413 Mint_InitAudio (this, spec); 413 Mint_InitAudio(this, spec);
414 414
415 return (1); /* We don't use SDL threaded audio */ 415 return (1); /* We don't use SDL threaded audio */
416 } 416 }
417 417
418 /* vi: set ts=4 sw=4 expandtab: */ 418 /* vi: set ts=4 sw=4 expandtab: */