# HG changeset patch # User Sam Lantinga # Date 1018740667 0 # Node ID 25809353f877616f05c4fe491c23bf344a8f744d # Parent 1b89c9ca9246a22f793168b8dd12a1277b1e4f60 Re-added MacOS X audio locking diff -r 1b89c9ca9246 -r 25809353f877 src/audio/macrom/SDL_romaudio.c --- a/src/audio/macrom/SDL_romaudio.c Sat Apr 13 20:33:21 2002 +0000 +++ b/src/audio/macrom/SDL_romaudio.c Sat Apr 13 23:31:07 2002 +0000 @@ -91,6 +91,10 @@ this->UnlockAudio = Mac_UnlockAudio; this->free = Audio_DeleteDevice; +#ifdef MACOSX /* MacOS X uses threaded audio, so normal thread code is okay */ + this->LockAudio = NULL; + this->UnlockAudio = NULL; +#endif return this; } @@ -100,7 +104,7 @@ }; #if defined(TARGET_API_MAC_CARBON) || defined(USE_RYANS_SOUNDCODE) -/* FIXME: Does this work correctly on MacOS X as well? */ +/* This works correctly on MacOS X */ #pragma options align=power @@ -115,19 +119,23 @@ static void mix_buffer(SDL_AudioDevice *audio, UInt8 *buffer) { if ( ! audio->paused ) { +#ifdef MACOSX + SDL_mutexP(audio->mixer_lock); +#endif if ( audio->convert.needed ) { - audio->spec.callback(audio->spec.userdata, + audio->spec.callback(audio->spec.userdata, (Uint8 *)audio->convert.buf,audio->convert.len); - SDL_ConvertAudio(&audio->convert); -#if 0 + SDL_ConvertAudio(&audio->convert); if ( audio->convert.len_cvt != audio->spec.size ) { - /* Uh oh... probably crashes here; */ + /* Uh oh... probably crashes here */; } -#endif memcpy(buffer, audio->convert.buf, audio->convert.len_cvt); } else { audio->spec.callback(audio->spec.userdata, buffer, audio->spec.size); } +#ifdef MACOSX + SDL_mutexV(audio->mixer_lock); +#endif } DecrementAtomic((SInt32 *) &need_to_mix);