comparison src/audio/mint/SDL_mintaudio_gsxb.c @ 1097:c83fa1c650dd

Move GSXB callback to C source
author Patrice Mandin <patmandin@gmail.com>
date Wed, 20 Jul 2005 17:44:11 +0000
parents 176240cf4405
children 856f76a099c7
comparison
equal deleted inserted replaced
1096:37b766becf3b 1097:c83fa1c650dd
74 static void Mint_UnlockAudio(_THIS); 74 static void Mint_UnlockAudio(_THIS);
75 75
76 /* To check/init hardware audio */ 76 /* To check/init hardware audio */
77 static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec); 77 static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec);
78 static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec); 78 static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec);
79
80 /* GSXB callbacks */
81 static void Mint_GsxbInterrupt(void);
82 static void Mint_GsxbNullInterrupt(void);
79 83
80 /*--- Audio driver bootstrap functions ---*/ 84 /*--- Audio driver bootstrap functions ---*/
81 85
82 static int Audio_Available(void) 86 static int Audio_Available(void)
83 { 87 {
178 { 182 {
179 /* Stop replay */ 183 /* Stop replay */
180 Buffoper(0); 184 Buffoper(0);
181 185
182 /* Uninstall interrupt */ 186 /* Uninstall interrupt */
183 if (NSetinterrupt(2, SI_NONE, SDL_MintAudio_EmptyGsxbInterrupt)<0) { 187 if (NSetinterrupt(2, SI_NONE, Mint_GsxbNullInterrupt)<0) {
184 DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n")); 188 DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed in close\n"));
185 } 189 }
186 190
187 /* Wait if currently playing sound */ 191 /* Wait if currently playing sound */
188 while (SDL_MintAudio_mutex != 0) { 192 while (SDL_MintAudio_mutex != 0) {
340 if (Setbuffer(0, buffer, buffer + spec->size)<0) { 344 if (Setbuffer(0, buffer, buffer + spec->size)<0) {
341 DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n")); 345 DEBUG_PRINT((DEBUG_NAME "Setbuffer() failed\n"));
342 } 346 }
343 347
344 /* Install interrupt */ 348 /* Install interrupt */
345 if (NSetinterrupt(2, SI_PLAY, SDL_MintAudio_GsxbInterrupt)<0) { 349 if (NSetinterrupt(2, SI_PLAY, Mint_GsxbInterrupt)<0) {
346 DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n")); 350 DEBUG_PRINT((DEBUG_NAME "NSetinterrupt() failed\n"));
347 } 351 }
348 352
349 /* Go */ 353 /* Go */
350 Buffoper(SB_PLA_ENA|SB_PLA_RPT); 354 Buffoper(SB_PLA_ENA|SB_PLA_RPT);
388 /* Setup audio hardware */ 392 /* Setup audio hardware */
389 Mint_InitAudio(this, spec); 393 Mint_InitAudio(this, spec);
390 394
391 return(1); /* We don't use threaded audio */ 395 return(1); /* We don't use threaded audio */
392 } 396 }
397
398 static void Mint_GsxbInterrupt(void)
399 {
400 Uint8 *newbuf;
401
402 if (SDL_MintAudio_mutex)
403 return;
404
405 SDL_MintAudio_mutex=1;
406
407 SDL_MintAudio_numbuf ^= 1;
408 SDL_MintAudio_Callback();
409 newbuf = SDL_MintAudio_audiobuf[SDL_MintAudio_numbuf];
410 Setbuffer(0, newbuf, newbuf + SDL_MintAudio_audiosize);
411
412 SDL_MintAudio_mutex=0;
413 }
414
415 static void Mint_GsxbNullInterrupt(void)
416 {
417 }