From a030d262a55e5f40b815b765ba84a5dc4047be6d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 4 Mar 2003 17:24:42 +0000 Subject: [PATCH] Darrell Walisser - Tue Mar 4 09:24:01 PST 2003 * Worked around MacOS X deadlock between CoreAudio and QuickTime --- CHANGES | 2 ++ native_midi/native_midi_mac.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 5f7a7262..f326de31 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 1.2.5: +Darrell Walisser - Tue Mar 4 09:24:01 PST 2003 + * Worked around MacOS X deadlock between CoreAudio and QuickTime Darrell Walisser - Fri, 14 Feb 2003 20:56:08 -0500 * Fixed crash in native midi code with files with more than 32 tracks Marc Le Douarain - Sat, 15 Feb 2003 14:46:41 +0100 diff --git a/native_midi/native_midi_mac.c b/native_midi/native_midi_mac.c index aaff5261..0063a758 100644 --- a/native_midi/native_midi_mac.c +++ b/native_midi/native_midi_mac.c @@ -180,6 +180,9 @@ void native_midi_start(NativeMidiSong *song) assert (gTunePlayer != NULL); + SDL_PauseAudio(1); + SDL_UnlockAudio(); + /* First, stop the currently playing music */ native_midi_stop(); @@ -191,7 +194,7 @@ void native_midi_start(NativeMidiSong *song) if (tpError != noErr) { strncpy (gErrorBuffer, "MIDI error during TuneSetTimeScale", ERROR_BUF_SIZE); - return; + goto done; } /* Set the header, to tell what instruments are used */ @@ -199,7 +202,7 @@ void native_midi_start(NativeMidiSong *song) if (tpError != noErr) { strncpy (gErrorBuffer, "MIDI error during TuneSetHeader", ERROR_BUF_SIZE); - return; + goto done; } /* Have it allocate whatever resources are needed */ @@ -207,7 +210,7 @@ void native_midi_start(NativeMidiSong *song) if (tpError != noErr) { strncpy (gErrorBuffer, "MIDI error during TunePreroll", ERROR_BUF_SIZE); - return; + goto done; } /* We want to play at normal volume */ @@ -215,7 +218,7 @@ void native_midi_start(NativeMidiSong *song) if (tpError != noErr) { strncpy (gErrorBuffer, "MIDI error during TuneSetVolume", ERROR_BUF_SIZE); - return; + goto done; } /* Finally, start playing the full song */ @@ -224,8 +227,12 @@ void native_midi_start(NativeMidiSong *song) if (tpError != noErr) { strncpy (gErrorBuffer, "MIDI error during TuneQueue", ERROR_BUF_SIZE); - return; + goto done; } + +done: + SDL_LockAudio(); + SDL_PauseAudio(0); } void native_midi_stop()