diff src/audio/macrom/SDL_romaudio.c @ 47:45b1c4303f87

Added initial support for Quartz video (thanks Darrell!)
author Sam Lantinga <slouken@lokigames.com>
date Thu, 07 Jun 2001 14:28:11 +0000
parents 74212992fb08
children e8157fcb3114
line wrap: on
line diff
--- a/src/audio/macrom/SDL_romaudio.c	Thu Jun 07 13:53:51 2001 +0000
+++ b/src/audio/macrom/SDL_romaudio.c	Thu Jun 07 14:28:11 2001 +0000
@@ -105,9 +105,8 @@
    UInt32 fill_me, play_me;
    SndCommand cmd; 
    SDL_AudioDevice *audio = (SDL_AudioDevice *)chan->userInfo;
- 
-   fill_me = cmd_passed->param2;  /* buffer that has just finished playing,
-so fill it */      
+   
+   fill_me = cmd_passed->param2;  /* buffer that has just finished playing, so fill it */      
    play_me = ! fill_me;           /* filled buffer to play _now_ */
 
    if ( ! audio->enabled ) {
@@ -119,15 +118,21 @@
    cmd.cmd = bufferCmd;
    cmd.param1 = 0; 
    cmd.param2 = (long)&header;
-   
-    SndDoCommand (chan, &cmd, 0);
+
+   SndDoCommand (chan, &cmd, 0);
    
    memset (buffer[fill_me], 0, audio->spec.size);
    
    if ( ! audio->paused ) {
         if ( audio->convert.needed ) {
-            audio->spec.callback(audio->spec.userdata,
-                (Uint8 *)audio->convert.buf,audio->convert.len);
+            #if MACOSX
+                SDL_mutexP(audio->mixer_lock);
+            #endif
+                audio->spec.callback(audio->spec.userdata,
+                    (Uint8 *)audio->convert.buf,audio->convert.len);
+            #if MACOSX
+                SDL_mutexV(audio->mixer_lock);
+            #endif 
                SDL_ConvertAudio(&audio->convert);
 #if 0
             if ( audio->convert.len_cvt != audio->spec.size ) {
@@ -137,11 +142,17 @@
             memcpy(buffer[fill_me], audio->convert.buf,
                             audio->convert.len_cvt);
         } else {
+            #if MACOSX
+                SDL_mutexP(audio->mixer_lock);
+            #endif
             audio->spec.callback(audio->spec.userdata,
                 (Uint8 *)buffer[fill_me], audio->spec.size);
+            #if MACOSX
+                SDL_mutexV(audio->mixer_lock);
+            #endif
         }
     }
-    
+
     if ( running ) {
          
       cmd.cmd = callBackCmd;
@@ -150,6 +161,7 @@
    
       SndDoCommand (chan, &cmd, 0);
    }
+
 }
 
 static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) {