Darrell Walisser - Tue Mar 4 09:24:01 PST 2003
authorSam Lantinga <slouken@libsdl.org>
Tue, 04 Mar 2003 17:24:42 +0000
changeset 223dbe04da11808
parent 222 9e383474c7cd
child 224 a32c256b1a74
Darrell Walisser - Tue Mar 4 09:24:01 PST 2003
* Worked around MacOS X deadlock between CoreAudio and QuickTime
CHANGES
native_midi/native_midi_mac.c
     1.1 --- a/CHANGES	Wed Feb 26 17:09:06 2003 +0000
     1.2 +++ b/CHANGES	Tue Mar 04 17:24:42 2003 +0000
     1.3 @@ -1,4 +1,6 @@
     1.4  1.2.5:
     1.5 +Darrell Walisser - Tue Mar  4 09:24:01 PST 2003
     1.6 + * Worked around MacOS X deadlock between CoreAudio and QuickTime
     1.7  Darrell Walisser - Fri, 14 Feb 2003 20:56:08 -0500
     1.8   * Fixed crash in native midi code with files with more than 32 tracks
     1.9  Marc Le Douarain - Sat, 15 Feb 2003 14:46:41 +0100
     2.1 --- a/native_midi/native_midi_mac.c	Wed Feb 26 17:09:06 2003 +0000
     2.2 +++ b/native_midi/native_midi_mac.c	Tue Mar 04 17:24:42 2003 +0000
     2.3 @@ -180,6 +180,9 @@
     2.4  	
     2.5  	assert (gTunePlayer != NULL);
     2.6  	
     2.7 +	SDL_PauseAudio(1);
     2.8 +	SDL_UnlockAudio();
     2.9 +    
    2.10  	/* First, stop the currently playing music */
    2.11  	native_midi_stop();
    2.12  	
    2.13 @@ -191,7 +194,7 @@
    2.14  	if (tpError != noErr)
    2.15  	{
    2.16  		strncpy (gErrorBuffer, "MIDI error during TuneSetTimeScale", ERROR_BUF_SIZE);
    2.17 -		return;
    2.18 +		goto done;
    2.19  	}
    2.20  
    2.21  	/* Set the header, to tell what instruments are used */
    2.22 @@ -199,7 +202,7 @@
    2.23  	if (tpError != noErr)
    2.24  	{
    2.25  		strncpy (gErrorBuffer, "MIDI error during TuneSetHeader", ERROR_BUF_SIZE);
    2.26 -		return;
    2.27 +		goto done;
    2.28  	}
    2.29  	
    2.30  	/* Have it allocate whatever resources are needed */
    2.31 @@ -207,7 +210,7 @@
    2.32  	if (tpError != noErr)
    2.33  	{
    2.34  		strncpy (gErrorBuffer, "MIDI error during TunePreroll", ERROR_BUF_SIZE);
    2.35 -		return;
    2.36 +		goto done;
    2.37  	}
    2.38  
    2.39  	/* We want to play at normal volume */
    2.40 @@ -215,7 +218,7 @@
    2.41  	if (tpError != noErr)
    2.42  	{
    2.43  		strncpy (gErrorBuffer, "MIDI error during TuneSetVolume", ERROR_BUF_SIZE);
    2.44 -		return;
    2.45 +		goto done;
    2.46  	}
    2.47  	
    2.48  	/* Finally, start playing the full song */
    2.49 @@ -224,8 +227,12 @@
    2.50  	if (tpError != noErr)
    2.51  	{
    2.52  		strncpy (gErrorBuffer, "MIDI error during TuneQueue", ERROR_BUF_SIZE);
    2.53 -		return;
    2.54 +		goto done;
    2.55  	}
    2.56 +    
    2.57 +done:
    2.58 +	SDL_LockAudio();
    2.59 +	SDL_PauseAudio(0);
    2.60  }
    2.61  
    2.62  void native_midi_stop()