diff -ruN timidity-0.2i/INSTALL timidity-0.2i-sgi/INSTALL
--- timidity-0.2i/INSTALL	Mon May 20 22:53:37 1996
+++ timidity-0.2i-sgi/INSTALL	Fri Mar 14 21:11:39 1997
@@ -32,6 +32,7 @@
 			* Linux/FreeBSD audio driver	  
 	    		* HP-UX network audio server
 			* Sun audio driver
+			* SGI/IRIX audio driver
 			* DEC MME driver
 
 	    b: select the kind of interface you want:
@@ -81,6 +82,10 @@
 	SunOS:
 
 		./timidity -OdM -s22050 midi/impromptu.mid
+
+	SGI/IRIX:
+
+		./timidity -OdM -s32000 midi/impromptu.mid
 
 	Windows:
 
diff -ruN timidity-0.2i/Makefile timidity-0.2i-sgi/Makefile
--- timidity-0.2i/Makefile	Sun May 26 11:26:46 1996
+++ timidity-0.2i-sgi/Makefile	Fri Mar 14 19:20:22 1997
@@ -25,7 +25,7 @@
 
 ########### Compiler and flags.
 CC = gcc
-DEBUGFLAGS = -Wall -O2
+DEBUGFLAGS = -O2 -Wall -pipe
 
 ########### Install.
 INSTALL = /usr/bin/install
@@ -71,6 +71,13 @@
 #EXTRAINCS += -I/usr/demo/SOUND
 #EXTRALIBS += -L/usr/demo/SOUND -laudio
 
+## Select the SGI audio driver (for IRIX)
+## You may have to use the IRIX cc compiler instead of gcc
+#SYSTEM += -DSGI -DAU_SGI
+#SYSEXTRAS += sgi_a.c
+#EXTRAINCS += 
+#EXTRALIBS += -laudio
+
 ## Select the Sun audio driver (for Solaris)
 #SYSTEM += -DSUN -DSOLARIS -DAU_SUN
 #SYSEXTRAS += sun_a.c
@@ -105,9 +112,9 @@
 ## Select the MOTIF interface
 #SYSTEM += -DMOTIF
 #SYSEXTRAS += motif_c.c motif_i.c motif_p.c
-#EXTRAINCS += -I/usr/local/X11R5/include -L/usr/local/X11R5/lib
+#EXTRAINCS += -I/usr/X11/include -L/usr/X11/lib
 #EXTRAINCS += -I/usr/include/X11
-#EXTRALIBS += -lXm -lXt -lX11
+#EXTRALIBS += -lXm -lXt -lX11 -lXpm -lXext
 ## Solaris needs libgen?
 #EXTRALIBS += -lgen
 
@@ -147,7 +154,7 @@
         wave_a.c raw_a.c dumb_c.c
 
 # Optional installation-specific sources
-OPTSRCS = hpux_a.c linux_a.c sun_a.c dec_a.c win_a.c \
+OPTSRCS = hpux_a.c linux_a.c sun_a.c dec_a.c win_a.c sgi_a.c \
 	ncurs_c.c slang_c.c tk_c.c \
 	motif_c.c motif_i.c motif_p.c
 
diff -ruN timidity-0.2i/README.SGI timidity-0.2i-sgi/README.SGI
--- timidity-0.2i/README.SGI	Thu Jan  1 01:00:00 1970
+++ timidity-0.2i-sgi/README.SGI	Fri Mar 14 21:25:51 1997
@@ -0,0 +1,49 @@
+Timidity 0.2i port to SGI/IRIX
+==============================
+
+	This port uses the SGI Audio Library, from the dmedia package, 
+which provides 16 bit,stereo and up to 48kHz playback frequencies. 
+This port has been successfully compiled and tested on an Indy machine, 
+running IRIX 6.2 but previous versions (at least 5.3) should work as well.
+        It was compiled using the IRIX cc compiler, and I don't know
+if it will work using gcc (it will probably work I guess, but who knows?).
+
+      In order to compile Timidity with the cc compiler, substitute the 
+following lines in the Makefile:
+
+########### Compiler and flags.
+CC = gcc
+DEBUGFLAGS = -O2 -Wall -pipe
+
+with:
+
+########### Compiler and flags.
+CC = cc
+DEBUGFLAGS = -O
+
+	   ... and don't forget to uncomment the SGI driver part in the Makefile.
+Also ensure that libaudio.a is somewhere in your linker's library path (probably
+/usr/lib/libaudio.a).
+
+	Note: the only allowed playback frequencies for SGI Timidity are:
+
+	- 8000 Hz
+	- 11025 Hz
+	- 16000 Hz
+	- 22050 Hz
+	- 32000 Hz (timidity builtin default)
+	- 44100 Hz (CD quality :-) )
+	- 48000 Hz (DAT quality ;*) )
+
+	The sgi_a.c driver was written using the unvaluable work from the MikMod
+player, which SGI port permitted me to learn how to use the SGI audio hardware.
+Thanks go to Stephan Kanthak (kanthak@i6.informatik.rwth-aachen.de), who wrote the
+MikMod SGI driver, and of course to Tuukka for this great software. :)
+
+
+		   Stephane Peter (speter@essi.fr)
+
+
+
+
+
diff -ruN timidity-0.2i/config.h timidity-0.2i-sgi/config.h
--- timidity-0.2i/config.h	Sat Jun  1 14:54:49 1996
+++ timidity-0.2i-sgi/config.h	Fri Mar 14 16:22:45 1997
@@ -222,6 +222,10 @@
 #  define LITTLE_ENDIAN
 #endif
 
+#ifdef SGI
+#  define BIG_ENDIAN
+#endif
+
 /* DEC MMS has 64 bit long words */
 #ifdef DEC
 typedef unsigned int uint32;
diff -ruN timidity-0.2i/output.c timidity-0.2i-sgi/output.c
--- timidity-0.2i/output.c	Mon May 20 16:04:54 1996
+++ timidity-0.2i-sgi/output.c	Thu Mar 13 15:26:50 1997
@@ -33,6 +33,11 @@
 #define DEFAULT_PLAY_MODE &dec_play_mode
 #endif
 
+#ifdef AU_SGI
+extern PlayMode sgi_play_mode;
+#define DEFAULT_PLAY_MODE &sgi_play_mode
+#endif
+
 #ifdef AU_LINUX
 extern PlayMode linux_play_mode;
 #define DEFAULT_PLAY_MODE &linux_play_mode
diff -ruN timidity-0.2i/output.h timidity-0.2i-sgi/output.h
--- timidity-0.2i/output.h	Mon May 20 15:09:46 1996
+++ timidity-0.2i-sgi/output.h	Fri Mar 14 13:58:33 1997
@@ -29,6 +29,10 @@
 #define PE_ULAW 	0x08  /* versus linear */
 #define PE_BYTESWAP	0x10  /* versus the other way */
 
+#ifdef  SGI
+#  define PI M_PI
+#endif
+
 typedef struct {
   int32 rate, encoding;
   int fd; /* file descriptor for the audio device */
diff -ruN timidity-0.2i/sgi_a.c timidity-0.2i-sgi/sgi_a.c
--- timidity-0.2i/sgi_a.c	Thu Jan  1 01:00:00 1970
+++ timidity-0.2i-sgi/sgi_a.c	Sun Mar 16 22:56:48 1997
@@ -0,0 +1,203 @@
+/* 
+
+    TiMidity -- Experimental MIDI to WAVE converter
+    Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    sgi_audio.c
+
+    Functions to play sound on the SGI/IRIX audio driver.
+
+    SGI port by Stephane Peter (Stephane.Peter@essi.fr). 
+
+*/
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dmedia/audio.h>
+
+#include "config.h"
+#include "output.h"
+#include "controls.h"
+
+static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
+static void close_output(void);
+static void output_data(int32 *buf, int32 count);
+static void flush_output(void);
+static void purge_output(void);
+
+/* export the playback mode */
+
+#define dpm sgi_play_mode
+
+PlayMode dpm = {
+  DEFAULT_RATE, PE_16BIT|PE_SIGNED,
+  -1,
+  {0}, /* default: get all the buffer fragments you can */
+  "SGI audio device", 'd',
+  "",
+  open_output,
+  close_output,
+  output_data,
+  flush_output,
+  purge_output  
+};
+
+static ALconfig sgi_config;
+static ALport sgi_port;
+static int sgi_bufsize;
+
+/*************************************************************************/
+/* We currently only honor the PE_MONO bit, the sample rate, and the
+   number of buffer fragments. We try 16-bit signed data first, and
+   then 8-bit unsigned if it fails. If you have a sound device that
+   can't handle either, let me know. */
+
+static int open_output(void)
+{
+  int tmp, warnings = 0;
+  long chpars[] = { AL_OUTPUT_RATE, AL_RATE_22050 };
+
+  /* Those are the only supported playback frequencies by the SGI Audio Lib */
+  switch(dpm.rate){
+  case 8000:
+    chpars[1] = AL_RATE_8000;
+    break;
+  case 11025:
+    chpars[1] = AL_RATE_11025;
+    break;
+  case 16000:
+    chpars[1] = AL_RATE_16000;
+    break;
+  case 22050:
+    chpars[1] = AL_RATE_22050;
+    break;
+  case 32000:
+    chpars[1] = AL_RATE_32000;
+    break;
+  case 44100:
+    chpars[1] = AL_RATE_44100;
+    break;
+  case 48000:
+    chpars[1] = AL_RATE_48000;
+    break;
+  default:
+    ctl->cmsg(CMSG_WARNING, VERB_NORMAL, 
+	      "%s doesn't support this sample rate, defaulting to 22kHz.",
+	      dpm.id_name);
+    chpars[1] = AL_RATE_22050;
+    warnings ++;
+  }
+  ALsetparams(AL_DEFAULT_DEVICE, chpars, 2);
+
+  if ((sgi_config = ALnewconfig()) == 0) {
+    ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+	      "Cannot configure sound device.");
+    return -1;
+  }
+	
+  if (dpm.encoding & PE_16BIT) {
+    if (ALsetwidth(sgi_config, AL_SAMPLE_16) < 0) {
+      ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+		"samplesize of 16 bits not supported.");
+      return -1;
+    }
+  } else {
+    if (ALsetwidth(sgi_config, AL_SAMPLE_8) < 0) {
+      ctl->cmsg(CMSG_ERROR, VERB_NORMAL, 
+		"samplesize of 8 bits not supported.");
+      return -1;
+    }
+  }
+
+  if (dpm.encoding & PE_MONO) {
+    if (ALsetchannels(sgi_config, AL_MONO) < 0) {
+      ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+		"mono mode not supported.");
+      return -1;
+    }
+  } else{
+    if (ALsetchannels(sgi_config, AL_STEREO) < 0) {
+      ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+		"stereo mode not supported.");
+      return -1;
+    }
+  }
+
+  tmp = AUDIO_BUFFER_BITS;
+  if (!(dpm.encoding & PE_MONO)) tmp++;
+  if (dpm.encoding & PE_16BIT) tmp++;
+  tmp |= (dpm.extra_param[0]<<16);
+  
+  sgi_bufsize = 1 << tmp;
+
+  if (ALsetqueuesize(sgi_config, sgi_bufsize) < 0){
+    ctl->cmsg(CMSG_WARNING, VERB_NORMAL,
+	      "%s doesn't support %d-byte buffer fragments",
+	      dpm.id_name, sgi_bufsize);
+    warnings ++; /* I hope it will work anyway... */
+  }
+
+  if ((sgi_port = ALopenport("Timidity", "w", sgi_config)) == 0) {
+    ctl->cmsg(CMSG_ERROR, VERB_NORMAL,
+	      "%s cannot open SGI audio port.\n",
+	      dpm.id_name);
+    return -1;
+  }
+
+  dpm.fd = ALgetfd(sgi_port);
+
+  return warnings;
+}
+
+static void output_data(int32 *buf, int32 count)
+{
+  if (!(dpm.encoding & PE_MONO)) count*=2; /* Stereo samples */
+  
+  if (dpm.encoding & PE_16BIT)
+    {
+      /* Convert data to signed 16-bit PCM */
+      s32tos16(buf, count);
+
+      ALwritesamps(sgi_port, buf, count);
+    }
+  else
+    {
+      /* Convert to 8-bit unsigned and write out. */
+      s32tou8(buf, count);
+      
+      ALwritesamps(sgi_port, buf, count);
+    }
+}
+
+static void close_output(void)
+{
+  ALcloseport(sgi_port);
+}
+
+static void flush_output(void)
+{
+  return;
+}
+
+static void purge_output(void)
+{
+  return;
+}
+
+
diff -ruN timidity-0.2i/timidity.c timidity-0.2i-sgi/timidity.c
--- timidity-0.2i/timidity.c	Tue May 21 21:16:20 1996
+++ timidity-0.2i-sgi/timidity.c	Fri Mar 14 13:55:54 1997
@@ -37,6 +37,7 @@
 #include <unistd.h>
 #endif
 
+#include <errno.h>
 #include "config.h"
 #include "common.h"
 #include "instrum.h"
