$NetBSD: patch-aw,v 1.1 2004/07/19 10:48:46 wiz Exp $

--- src/audio/dmedia/SDL_irixaudio.c.orig	2003-08-30 21:13:02.000000000 +0200
+++ src/audio/dmedia/SDL_irixaudio.c
@@ -28,6 +28,7 @@ static char rcsid =
 #endif
 
 /* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */
+/* patch for IRIX 5 by Georg Schwarz 18/07/2004 */
 
 #include <stdlib.h>
 
@@ -39,6 +40,21 @@ static char rcsid =
 #include "SDL_irixaudio.h"
 
 
+#ifdef AL_RESOURCE /* as a test whether we use the "new" IRIX
+                       audio libraries */
+#define NEW_IRIX_AUDIO
+#else
+#define alClosePort(x) ALcloseport(x)
+#define alFreeConfig(x) ALfreeconfig(x)
+#define alGetFillable(x) ALgetfillable(x)
+#define alNewConfig() ALnewconfig()
+#define alOpenPort(x,y,z) ALopenport(x,y,z)
+#define alSetChannels(x,y) ALsetchannels(x,y)
+#define alSetQueueSize(x,y) ALsetqueuesize(x,y)
+#define alSetSampFmt(x,y) ALsetsampfmt(x,y)
+#define alSetWidth(x,y) ALsetwidth(x,y)
+#endif
+
 /* Audio driver functions */
 static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec);
 static void AL_WaitAudio(_THIS);
@@ -137,7 +153,11 @@ static void AL_CloseAudio(_THIS)
 static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec)
 {
 	ALconfig audio_config;
+#ifdef NEW_IRIX_AUDIO
 	ALpv audio_param;
+#else
+	long audio_param[2];
+#endif
 	int width;
 
 	/* Determine the audio parameters from the AudioSpec */
@@ -165,9 +185,16 @@ static int AL_OpenAudio(_THIS, SDL_Audio
 	SDL_CalculateAudioSpec(spec);
 
 	/* Set output frequency */
+#ifdef NEW_IRIX_AUDIO
 	audio_param.param = AL_RATE;
 	audio_param.value.i = spec->freq;
-	if( alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0 ) {
+	if( alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0 )
+#else
+	audio_param[0] = AL_OUTPUT_RATE;
+	audio_param[1] = spec->freq;
+	if( ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0 )
+#endif
+	{
 		SDL_SetError("alSetParams failed");
 		return(-1);
 	}
