comparison src/audio/mint/SDL_mintaudio_xbios.c @ 2043:adf732f1f016

Formatting update
author Sam Lantinga <slouken@libsdl.org>
date Sun, 24 Sep 2006 15:56:55 +0000
parents d48ead2d2ba5
children 5f6550e5184f b19680c84cdf
comparison
equal deleted inserted replaced
2042:3908e1f808e1 2043:adf732f1f016
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 SDL_MintAudio_mint_present = SDL_FALSE; 87 SDL_MintAudio_mint_present = SDL_FALSE;
88 88
89 /* We can't use XBIOS in interrupt with Magic, don't know about thread */ 89 /* We can't use XBIOS in interrupt with Magic, don't know about thread */
90 if (Getcookie(C_MagX, &dummy) == C_FOUND) { 90 if (Getcookie(C_MagX, &dummy) == C_FOUND) {
91 return (0); 91 return (0);
358 Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) 358 Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
359 { 359 {
360 int i; 360 int i;
361 Uint32 extclock; 361 Uint32 extclock;
362 362
363 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format))); 363 DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",
364 SDL_AUDIO_BITSIZE(spec->format)));
364 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format))); 365 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
365 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format))); 366 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
366 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format))); 367 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
367 DEBUG_PRINT(("channels=%d, ", spec->channels)); 368 DEBUG_PRINT(("channels=%d, ", spec->channels));
368 DEBUG_PRINT(("freq=%d\n", spec->freq)); 369 DEBUG_PRINT(("freq=%d\n", spec->freq));
369 370
370 spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */ 371 spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
371 372
372 /* clamp out int32/float32 */ 373 /* clamp out int32/float32 */
373 if (SDL_AUDIO_BITSIZE(spec->format) >= 16) { 374 if (SDL_AUDIO_BITSIZE(spec->format) >= 16) {
374 spec->format = AUDIO_S16MSB; /* Audio is always big endian */ 375 spec->format = AUDIO_S16MSB; /* Audio is always big endian */
375 spec->channels = 2; /* 16 bits always stereo */ 376 spec->channels = 2; /* 16 bits always stereo */
376 } else if (spec->channels > 2) { 377 } else if (spec->channels > 2) {
377 spec->channels = 2; /* no more than stereo! */ 378 spec->channels = 2; /* no more than stereo! */
378 } 379 }
379 380
380 MINTAUDIO_freqcount = 0; 381 MINTAUDIO_freqcount = 0;
381 382
382 /* Add external clocks if present */ 383 /* Add external clocks if present */
404 #endif 405 #endif
405 406
406 MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); 407 MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
407 spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; 408 spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
408 409
409 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format))); 410 DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",
411 SDL_AUDIO_BITSIZE(spec->format)));
410 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format))); 412 DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
411 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format))); 413 DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
412 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format))); 414 DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
413 DEBUG_PRINT(("channels=%d, ", spec->channels)); 415 DEBUG_PRINT(("channels=%d, ", spec->channels));
414 DEBUG_PRINT(("freq=%d\n", spec->freq)); 416 DEBUG_PRINT(("freq=%d\n", spec->freq));
466 if (SDL_MintAudio_mint_present) { 468 if (SDL_MintAudio_mint_present) {
467 SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0); 469 SDL_MintAudio_thread_pid = tfork(SDL_MintAudio_Thread, 0);
468 } else { 470 } else {
469 /* Install interrupt */ 471 /* Install interrupt */
470 Jdisint(MFP_DMASOUND); 472 Jdisint(MFP_DMASOUND);
471 /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/ 473 /*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt); */
472 Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt); 474 Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
473 Jenabint(MFP_DMASOUND); 475 Jenabint(MFP_DMASOUND);
474 476
475 if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) { 477 if (Setinterrupt(SI_TIMERA, SI_PLAY) < 0) {
476 DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n")); 478 DEBUG_PRINT((DEBUG_NAME "Setinterrupt() failed\n"));