Tested with various .wav files: 8-bit, 16-bit, stereo, mono,
11.025kHz, and 48kH. BTW without this it didn't work at all on my
setup.

(I had to rename the patches because I couldn't make "make
update-patches" work well on them)

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/xanim/Makefile,v
retrieving revision 1.33
diff -u -p -u -p -r1.33 Makefile
--- Makefile    16 Feb 2015 22:57:08 -0000      1.33
+++ Makefile    26 Jun 2015 15:37:46 -0000
@@ -3,7 +3,7 @@
 COMMENT=       X11 animation player with support for lots of formats
 
 DISTNAME=xanim-2.80.1
-REVISION =     4
+REVISION =     5
 WRKDIST=${WRKDIR}/xanim2801
 CATEGORIES= graphics x11
 
Index: patches/i386-patch
===================================================================
RCS file: patches/i386-patch
diff -N patches/i386-patch
--- patches/i386-patch  23 Apr 2003 08:30:05 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
---- Imakefile.orig2    Thu Mar 18 22:45:51 1999
-+++ Imakefile  Thu Mar 18 22:46:40 1999
-@@ -165,13 +165,13 @@
- XCOMM  
- XCOMM  Again don't use these if you are using the dynamically loadable 
modules.
- XCOMM 
--XCOMM XA_IV32_DEF = -DXA_IV32 
--XCOMM XA_CVID_DEF = -DXA_CVID
--XCOMM XA_CYUV_DEF = -DXA_CYUV
-+XA_IV32_DEF = -DXA_IV32 
-+XA_CVID_DEF = -DXA_CVID
-+XA_CYUV_DEF = -DXA_CYUV
- XCOMM 
--XCOMM XA_IV32_LIB = mods/xa2.1_iv32_linuxELF.o
--XCOMM XA_CVID_LIB = mods/xa2.0_cvid_linuxELF.o
--XCOMM XA_CYUV_LIB = mods/xa1.0_cyuv_linuxELF.o
-+XA_IV32_LIB = xa2.0_iv32_linuxELF.o
-+XA_CVID_LIB = xa2.0_cvid_linuxELF.o
-+XA_CYUV_LIB = xa1.0_cyuv_linuxELF.o
- XCOMM 
- XCOMM ##########################
- XCOMM  NOTE: SGI Machines Only: 
Index: patches/patch-Imakefile
===================================================================
RCS file: patches/patch-Imakefile
diff -N patches/patch-Imakefile
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Imakefile     26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,117 @@
+$OpenBSD$
+--- Imakefile.orig     Sun Mar 21 23:36:26 1999
++++ Imakefile  Fri Jun 26 12:29:50 2015
+@@ -96,7 +96,7 @@ XCOMM   Specify any Linker flags needed to allow dynam
+ XCOMM   to link against symbols inside xanim.
+ XCOMM 
+ XCOMM ## Linux
+-LD_FLAGS = -rdynamic
++XCOMM LD_FLAGS = -rdynamic
+ XCOMM ## SunOS/Solaris use:
+ XCOMM  LD_FLAGS =
+ 
+@@ -111,17 +111,17 @@ XCOMM
+ XCOMM NOTE: not all machines need the XA_DLL_LIB define.
+ XCOMM 
#########################################################################
+ XCOMM 
+-XA_DLL_DEF = -DXA_DLL -DXA_PRINT
++XCOMM XA_DLL_DEF = -DXA_DLL -DXA_PRINT
+ XCOMM ### Use this only if the above doesn't work
+ XCOMM XA_DLL_DEF = -DXA_DLL
+ XCOMM
+ XCOMM ### You may need this library.
+-XA_DLL_LIB = -ldl
++XCOMM XA_DLL_LIB = -ldl
+ XCOMM
+ XCOMM If you'd like to change the default directory that XAnim searches while
+ XCOMM looking for dlls, then change the directory below.
+ XCOMM
+-XA_DLL_PATH = /usr/local/xanim/mods
++XCOMM XA_DLL_PATH = /usr/local/xanim/mods
+ 
+ 
+ 
+@@ -267,8 +267,8 @@ XCOMM  -- NOTE_9 Since xanim doesn't yet support Win32
+ XCOMM  XA_AUDIO_DEFS =
+ XCOMM 
+ XCOMM ## -- Linux PCs 
---------------------------------------------------------
+-XA_AUDIO_DEFS = -DXA_LINUX_AUDIO
+-XA_AUDIO_LIBS = -lc
++XCOMM XA_AUDIO_DEFS = -DXA_LINUX_AUDIO
++XCOMM XA_AUDIO_LIBS = -lc
+ XCOMM 
+ XCOMM  -- Linux PC's with OLD Rev sound drivers 
-------------------------------
+ XCOMM  XA_AUDIO_DEFS = -DXA_LINUX_AUDIO -DXA_LINUX_OLDER_SND
+@@ -309,6 +309,10 @@ XCOMM 
+ XCOMM  -- NetBSD-current (as of 30/April 
1995)---------------------------------
+ XCOMM  XA_AUDIO_DEFS = -DXA_NetBSD_AUDIO
+ XCOMM 
++XCOMM  -- OpenBSD, from at least 2.4 to now
++XA_AUDIO_DEFS = -DXA_OpenBSD_AUDIO
++XA_AUDIO_LIBS = -lsndio
++XCOMM 
+ XCOMM  -- QNX 4.2 PC's 
--------------------------------------------------------
+ XCOMM  XA_AUDIO_DEFS = -DXA_LINUX_AUDIO -DXA_SELECT
+ XCOMM  XA_AUDIO_LIBS = -lc
+@@ -442,7 +446,7 @@ XCOMM    -- about not finding multibuf.h or the
+ XCOMM    -- following symbols(XmbufDisplayBuffers, XmbufQueryExtension,
+ XCOMM    --  XmbufCreateBuffers).
+ XCOMM    -- NOTE_8: HP-UX machines need to comment this out.
+-XCOMM  XA_MULTIBUF = -DXMBUF
++XA_MULTIBUF = -DXMBUF
+ XCOMM 
+ XCOMM ###########
+ XCOMM 
+@@ -465,7 +469,7 @@ DEFINES  = $(XA_DEFS)
+ 
+ PROGRAMS = $(XANIM)
+ 
+-INCLUDES = -I$(INCDIR) $(XA_INCS)
++INCLUDES = -I/usr/X11R6/include/X11 $(XA_INCS)
+ 
+    LIBS1 = $(XA_LIBS) $(EXTENSIONLIB) $(XTOOLLIB) $(XLIB) -lm
+ DEPLIBS1 = $(DEPEXTENSIONLIB) $(DEPXTOOLLIB) $(DEPXLIB)
+@@ -504,43 +508,3 @@ ComplexProgramTarget_1(xanim, $(LIBS1), $(OTHER_LIBS) 
+ xaclean::
+       $(RM) $(OBJS1)
+ 
+-
+-XCOMM  DO NOT DELETE THIS LINE
+-xanim.o: Imakefile xanim.h xa_config.h xa_x11.h xanim.c
+-xa1.0_kpcd.o: xa1.0_kpcd.c
+-unpacker.o: unpacker.c
+-xa_acodec.o: Imakefile xanim.h xa_acodec.c
+-xa_act.o: xanim.h xa_config.h xa_act.c
+-xa_au.o: xanim.h xa_config.h xa_au.c
+-xa_audio.o: Imakefile xanim.h xa_config.h xa_audio.h xa_audio.c
+-xa_avi.o: Imakefile xanim.h xa_config.h xa_avi.h xa_codecs.h xa_xmpg.h 
xa_avi.c
+-xa_cmap.o: xanim.h xa_config.h xa_cmap.c
+-xa_color.o: xanim.h xa_color.c
+-xa_dl.o: xanim.h xa_config.h xa_dl.h xa_dl.c
+-xa_dumfx.o: xanim.h xa_dumfx.c
+-xa_fli.o: xanim.h xa_config.h xa_fli.h xa_fli.c
+-xa_formats.o: xanim.h xa_formats.c
+-xa_gif.o: xanim.h xa_config.h xa_gif.h xa_gif.c
+-xa_iff.o: xanim.h xa_config.h xa_iff.h xa_iff.c
+-xa_input.o: xanim.h xa_input.c
+-xa_ipc.o: Imakefile xanim.h xa_config.h xa_ipc.h xa_ipc.c
+-xa_jmov.o: xanim.h xa_config.h xa_jmov.h xa_jmov.c
+-xa_jpg.o: xanim.h xa_config.h xa_jpg.h xa_jpg.c
+-xa_j6i.o: xanim.h xa_j6i.h xa_j6i.c
+-xa_movi.o: xanim.h xa_config.h xa_movi.h xa_movi.c
+-xa_mpg.o: xanim.h xa_config.h xa_mpg.h xa_xmpg.h xa_mpg.c xa_jpg.c
+-xa_qt.o: Imakefile xanim.h xa_config.h xa_qt.h xa_codecs.h xa_qt.c
+-xa_qt_decs.o: Imakefile xanim.h xa_config.h xa_qt.h xa_qt_decs.c
+-xa_vid_codec.o: Imakefile xa_avi.h xa_qt.h xa_codecs.h xavid.h xavid_mod.h
+-xa_vid_codec.o: xa_vid_codec.c
+-xa_replay.o: xanim.h xa_config.h xa_replay.h xa_replay.c
+-xa_rle.o: xanim.h xa_config.h xa_rle.h xa_rle.c
+-xa_set.o: xanim.h xa_config.h xa_iff.h xa_iff.c xa_set.h xa_set.c
+-xa_raw.o: xanim.h xa_raw.h xa_raw.c
+-xa_show.o: Imakefile xanim.h xa_show.c
+-xa_txt.o: xanim.h xa_config.h xa_txt.c
+-xa_utils.o: xanim.h xa_config.h xa_utils.c
+-xa_wav.o: xanim.h xa_config.h xa_avi.h xa_wav.c
+-xa_8svx.o: xanim.h xa_8svx.h xa_8svx.c
+-xa_x11.o: Imakefile xanim.h xa_config.h xa_x11.h xa_x11.c
+-xa_gsm.o: xanim.h xa_gsm_state.h xa_gsm.h xa_gsm.c
Index: patches/patch-a
===================================================================
RCS file: patches/patch-a
diff -N patches/patch-a
--- patches/patch-a     1 May 2015 16:51:25 -0000       1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
---- xa_audio.h.orig    Thu Mar 18 21:51:23 1999
-+++ xa_audio.h Thu Mar 18 21:52:46 1999
-@@ -114,6 +114,17 @@
- #include <sys/ioccom.h>
- #endif
- 
-+/*********************** OpenBSD INCLUDES *******************************/
-+#ifdef XA_OpenBSD_AUDIO
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <sys/audioio.h>
-+#include <sys/file.h>
-+#include <sys/stat.h>
-+#include <sys/ioctl.h>
-+#include <sys/ioccom.h>
-+#include <endian.h>
-+#endif
- 
- /*********************** LINUX INCLUDES ********************************/
- #ifdef XA_LINUX_AUDIO
Index: patches/patch-b
===================================================================
RCS file: patches/patch-b
diff -N patches/patch-b
--- patches/patch-b     19 Mar 1999 01:20:48 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,477 +0,0 @@
---- xa_audio.c.orig    Tue Mar 16 00:58:48 1999
-+++ xa_audio.c Fri Mar 19 01:15:03 1999
-@@ -114,6 +114,7 @@
-  * 21Feb99 - Added routine *_Audio_Prep  to hide initialization delays
-  *         when starting audio.
-  * 02Mar99 - Linux: Change XA_LINUX_NEWER_SND TO OLDER_SND to avoid confusion.
-+ * 18Mar99 - OpenBSD: newer configuration, solves a few problems.
-  *
-  ****************************************************************************/
- 
-@@ -4936,6 +4937,402 @@
- /******************* END OF NetBSD SPECIFIC ROUTINES ************************/
- /****************************************************************************/
- 
-+/****************************************************************************/
-+/**************** OpenBSD SPECIFIC ROUTINES *********************************/
-+/****************************************************************************/
-+
-+/*
-+ * Based on the NetBSD port initially, 
-+ * contributed by Marc Espie <[email protected]>
-+ * This code may actually work on NetBSD, but this is not my place to
-+ * change this.
-+ *
-+ * This code tries not to abuse AUDIO_SETINFO, as this can be an expensive
-+ * ioctl on some arches. Also, it is able to deal with weirder audio
-+ * devices, such as those found on amiga or sparcs.
-+ */
-+
-+#ifdef XA_OpenBSD_AUDIO
-+
-+void  OpenBSD_Audio_Init();
-+void  OpenBSD_Audio_Kill();
-+void  OpenBSD_Audio_Off();
-+void  OpenBSD_Audio_Prep();
-+void  OpenBSD_Audio_On();
-+void  OpenBSD_Adjust_Volume();
-+xaULONG OpenBSD_Closest_Freq();
-+void OpenBSD_Set_Output_Port();
-+void OpenBSD_Speaker_Toggle();
-+void OpenBSD_Headphone_Toggle();
-+
-+#define OpenBSD_MAX_VOL AUDIO_MAX_GAIN
-+#define OpenBSD_MIN_VOL AUDIO_MIN_GAIN
-+
-+static int devAudio;
-+
-+/********** XA_Audio_Setup **********************
-+ * 
-+ * Also defines OpenBSD Specific variables.
-+ *
-+ *****/
-+void XA_Audio_Setup()
-+{
-+  XA_Audio_Init               = OpenBSD_Audio_Init;
-+  XA_Audio_Kill               = OpenBSD_Audio_Kill;
-+  XA_Audio_Off                = OpenBSD_Audio_Off;
-+  XA_Audio_Prep               = OpenBSD_Audio_Prep;
-+  XA_Audio_On         = OpenBSD_Audio_On;
-+  XA_Closest_Freq     = OpenBSD_Closest_Freq;
-+  XA_Set_Output_Port  = OpenBSD_Set_Output_Port;
-+  XA_Speaker_Tog      = OpenBSD_Speaker_Toggle;
-+  XA_Headphone_Tog    = OpenBSD_Headphone_Toggle;
-+  XA_LineOut_Tog      = OpenBSD_Headphone_Toggle;
-+  XA_Adjust_Volume    = OpenBSD_Adjust_Volume;
-+
-+  xa_snd_cur = 0;
-+  xa_audio_present = XA_AUDIO_UNK;
-+  xa_audio_status  = XA_AUDIO_STOPPED;
-+  xa_audio_ring_size  = 8;
-+}
-+
-+/********** OpenBSD_Audio_Init **********************
-+ * Open /dev/audio and OpenBSD.
-+ *
-+ *****/
-+void OpenBSD_Audio_Init()
-+{ int ret;
-+  int type;
-+  audio_info_t a_info;
-+  struct audio_encoding query;
-+  DEBUG_LEVEL2 fprintf(stderr,"OpenBSD_Audio_Init\n");
-+  if (xa_audio_present != XA_AUDIO_UNK) return;
-+  devAudio = open("/dev/audio", O_WRONLY | O_NDELAY);
-+  if (devAudio == -1)
-+  {
-+    if (errno == EBUSY) fprintf(stderr,"Audio_Init: Audio device is busy. - 
");
-+    else fprintf(stderr,"Audio_Init: Error opening audio device. - ");
-+    fprintf(stderr,"Will continue without audio\n");
-+    xa_audio_present = XA_AUDIO_ERR;
-+    return;
-+  }
-+
-+  DEBUG_LEVEL1 fprintf(stderr,"OpenBSD AUDIO\n");
-+
-+  AUDIO_INITINFO(&a_info);
-+  a_info.blocksize = 1024;
-+  a_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
-+  a_info.play.sample_rate = 11025;   /* this is changed later */
-+
-+  /* find true native formats */
-+  for (query.index = 0;
-+      ioctl(devAudio, AUDIO_GETENC, &query) != -1;
-+      query.index++)
-+      {
-+      if (query.flags & AUDIO_ENCODINGFLAG_EMULATED)
-+              continue;
-+      if (query.precision == 16)
-+              {
-+              a_info.play.encoding = query.encoding;
-+              a_info.play.precision = query.precision;
-+              break;
-+              }
-+      if ((query.precision == 8) && (
-+              (query.encoding == AUDIO_ENCODING_SLINEAR) || 
-+              (query.encoding == AUDIO_ENCODING_ULINEAR)) )
-+              {
-+              a_info.play.encoding = query.encoding;
-+              a_info.play.precision = query.precision;
-+              }
-+              /* no linear format -> resort to log formats */
-+      if (a_info.play.precision != 8)
-+              {
-+              if ( query.encoding == AUDIO_ENCODING_ULAW) 
-+                      a_info.play.encoding = query.encoding;
-+              }
-+      }
-+  /* set format, then retrieve what the device actually says */
-+  ioctl(devAudio, AUDIO_SETINFO, &a_info);
-+  ioctl(devAudio, AUDIO_GETINFO, &a_info);
-+
-+  switch(a_info.play.encoding)
-+      {
-+  case AUDIO_ENCODING_SLINEAR:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_SIGNED_1M :
-+#if BYTE_ORDER == BIG_ENDIAN
-+      XA_AUDIO_SIGNED_2MB;
-+#else
-+      XA_AUDIO_SIGNED_2ML;
-+#endif
-+      break;
-+  case AUDIO_ENCODING_ULINEAR:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_LINEAR_1M :
-+#if BYTE_ORDER == BIG_ENDIAN
-+      XA_AUDIO_LINEAR_2MB;
-+#else
-+      XA_AUDIO_LINEAR_2ML;
-+#endif
-+      break;
-+  case AUDIO_ENCODING_ULAW:
-+   xa_audio_hard_type = XA_AUDIO_SUN_AU;
-+      break;
-+  case AUDIO_ENCODING_ULINEAR_LE:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_LINEAR_1M :
-+              XA_AUDIO_LINEAR_2ML;
-+      break;
-+  case AUDIO_ENCODING_ULINEAR_BE:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_LINEAR_1M :
-+              XA_AUDIO_LINEAR_2MB;
-+      break;
-+  case AUDIO_ENCODING_SLINEAR_LE:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_SIGNED_1M :
-+              XA_AUDIO_SIGNED_2ML;
-+      break;
-+  case AUDIO_ENCODING_SLINEAR_BE:
-+      xa_audio_hard_type = a_info.play.precision == 8 ? XA_AUDIO_SIGNED_1M :
-+              XA_AUDIO_SIGNED_2MB;
-+      break;
-+  default:
-+    fprintf(stderr,"Audio_Init: Weird audio format %d\n",
-+       a_info.play.encoding);
-+    fprintf(stderr,"Will continue without audio\n");
-+    xa_audio_present = XA_AUDIO_ERR;
-+       close(devAudio);
-+       return;
-+   }
-+
-+  xa_audio_hard_freq  = a_info.play.sample_rate;
-+  xa_audio_hard_buff  = a_info.blocksize;
-+
-+      /* only precision 8 and 16 are supported. Fail if otherwise?? */
-+  xa_audio_hard_bps   = (a_info.play.precision==8)?1:2;
-+  xa_audio_hard_chans = a_info.play.channels;
-+  Gen_uLaw_2_Signed();
-+  Gen_Signed_2_uLaw();
-+
-+  xa_interval_id = 0;
-+  xa_audio_present = XA_AUDIO_OK;
-+  DEBUG_LEVEL2 fprintf(stderr,"   success \n");
-+  Init_Audio_Ring(xa_audio_ring_size,
-+                      (XA_AUDIO_MAX_RING_BUFF * xa_audio_hard_bps) );
-+}
-+
-+/********** OpenBSD_Audio_Kill **********************
-+ * Close /dev/audio.
-+ *
-+ *****/
-+void OpenBSD_Audio_Kill()
-+{ 
-+  /* TURN AUDIO OFF */
-+  OpenBSD_Audio_Off(0);
-+  xa_audio_present = XA_AUDIO_UNK;
-+  /* SHUT THINGS DOWN  */
-+  close(devAudio);
-+  Kill_Audio_Ring();
-+}
-+
-+/********** OpenBSD_Audio_Off **********************
-+ * Stop Audio Stream
-+ *
-+ *****/
-+void OpenBSD_Audio_Off(flag)
-+xaULONG flag;
-+{ /* long ret; */
-+
-+  DEBUG_LEVEL1 fprintf(stderr,"OpenBSD_Audio_Off\n");
-+  if (xa_audio_status != XA_AUDIO_STARTED) return;
-+
-+  /* SET FLAG TO STOP OUTPUT ROUTINE */
-+  xa_audio_status = XA_AUDIO_STOPPED;
-+
-+  /* TURN OFF SOUND ??? */
-+  OpenBSD_Adjust_Volume(XA_AUDIO_MINVOL);
-+
-+  /* FLUSH AUDIO DEVICE */ /* NOT! */
-+/*
-+  ret = ioctl(devAudio, AUDIO_FLUSH, NULL);
-+  if (ret == -1) fprintf(stderr,"OpenBSD Audio: off flush err %d\n",errno);
-+*/
-+
-+  xa_time_audio = -1;
-+  xa_audio_flushed = 0;
-+
-+  /* FLUSH AUDIO DEVICE AGAIN */ /* NOT! */
-+/*
-+  ret = ioctl(devAudio, AUDIO_FLUSH, NULL);
-+  if (ret == -1) fprintf(stderr,"OpenBSD Audio: off flush err %d\n",errno);
-+*/
-+
-+  /* RESTORE ORIGINAL VOLUME */
-+  if (XAAUD->mute != xaTRUE) OpenBSD_Adjust_Volume(XAAUD->volume);
-+}
-+
-+/********** OpenBSD_Audio_Prep **********************
-+ * Turn On Audio Stream.
-+ *
-+ *****/
-+void OpenBSD_Audio_Prep()
-+{
-+  DEBUG_LEVEL2 
-+  {
-+    fprintf(stderr,"OpenBSD_Audio_Prep \n");
-+  }
-+  if (xa_audio_status == XA_AUDIO_STARTED) return;
-+  else if (xa_audio_present != XA_AUDIO_OK) return;
-+
-+  else if (xa_snd_cur)
-+  { int ret;
-+
-+    /* CHANGE FREQUENCY IF NEEDED */
-+    if (xa_audio_hard_freq != xa_snd_cur->hfreq)
-+    { audio_info_t a_info;
-+      AUDIO_INITINFO(&a_info); 
-+      a_info.play.sample_rate = xa_snd_cur->hfreq;
-+      ret = ioctl(devAudio, AUDIO_SETINFO, &a_info);
-+      if (ret == -1) fprintf(stderr,"audio setfreq: freq %x errno %d\n",
-+                                              xa_snd_cur->hfreq, errno);
-+      xa_audio_hard_freq = xa_snd_cur->hfreq;
-+    }
-+
-+    /* xa_snd_cur gets changes in Update_Ring() */
-+    xa_out_time = 100;  /* keep audio fed 500ms ahead of video */  /* was 
500, changed it to 100 - rcd */
-+    xa_out_init = xa_audio_ring_size - 1;
-+    xa_interval_time = xa_snd_cur->ch_time / XAAUD->divtest;
-+    if (xa_interval_time == 0) xa_interval_time = 1;
-+
-+    XA_Flush_Ring();
-+    XA_Update_Ring(1000);
-+    xa_audio_status = XA_AUDIO_PREPPED;
-+  }
-+}
-+
-+/****-------------------------------------------------------------------****
-+ *
-+ ****-------------------------------------------------------------------****/
-+void OpenBSD_Audio_On()
-+{
-+  if (   (xa_snd_cur)
-+      && (xa_audio_present == XA_AUDIO_OK)
-+      && (xa_audio_status == XA_AUDIO_PREPPED) )
-+  { 
-+    xa_audio_status = XA_AUDIO_STARTED;
-+    xa_time_now = XA_Read_AV_Time();  /* get new time */
-+    New_Merged_Audio_Output();
-+  }
-+}
-+
-+
-+/********** OpenBSD_Closest_Freq 
**********************************************
-+ *
-+ * Global Variable Affect:
-+ *   xaULONG xa_audio_hard_buff               must set but not larger than
-+ *                                    XA_AUDIO_MAX_RING_BUF size
-+ ****************************************************************************/
-+xaULONG OpenBSD_Closest_Freq(ifreq)
-+xaLONG ifreq;
-+{ 
-+static int cache_ifreq =0, cache_ofreq = 0;
-+  if (cache_ifreq == ifreq || cache_ofreq == ifreq)
-+    return cache_ofreq;
-+  else
-+    { audio_info_t a_info;
-+
-+    AUDIO_INITINFO(&a_info);
-+    a_info.play.sample_rate = ifreq;
-+    ioctl(devAudio, AUDIO_SETINFO, &a_info);
-+
-+    ioctl(devAudio, AUDIO_GETINFO, &a_info);
-+
-+    xa_audio_hard_buff  = a_info.blocksize;
-+    cache_ifreq = ifreq;
-+    cache_ofreq = a_info.play.sample_rate;
-+    return (a_info.play.sample_rate);
-+    }
-+}
-+
-+
-+/* Eventually merge everything to one */
-+void OpenBSD_Set_Output_Port(aud_ports)
-+xaULONG aud_ports;
-+{
-+/* Commented out for now ;-) */
-+/*
-+audio_info_t a_info;
-+  xaLONG ret;
-+  xaULONG OpenBSD_ports = 0;
-+  if (aud_ports & XA_AUDIO_PORT_INT)  OpenBSD_ports |= AUDIO_SPEAKER;
-+  if (aud_ports & XA_AUDIO_PORT_HEAD) OpenBSD_ports |= AUDIO_HEADPHONE;
-+  if (aud_ports & XA_AUDIO_PORT_EXT)  OpenBSD_ports |= AUDIO_LINE_OUT;
-+  AUDIO_INITINFO(&a_info);
-+  a_info.play.port = OpenBSD_ports;
-+  ret = ioctl(devAudio, AUDIO_SETINFO, &a_info);
-+  if (ret < 0) fprintf(stderr,"Audio: couldn't set speaker port %d\n",errno);
-+*/
-+}
-+
-+/************* OpenBSD_Speaker_Toggle 
*****************************************
-+ *
-+ * flag = 0  turn speaker off
-+ * flag = 1  turn speaker on
-+ * flag = 2  toggle speaker
-+ ****************************************************************************/
-+void OpenBSD_Speaker_Toggle(flag)
-+xaULONG flag;
-+{ 
-+  switch(flag)
-+  {
-+    case  0: XAAUD->port &= ~XA_AUDIO_PORT_INT; break;
-+    case  1: XAAUD->port |=  XA_AUDIO_PORT_INT; break;
-+    default:  /* mutually exclusive set for now - never turn off */
-+    { if ( !(XAAUD->port & XA_AUDIO_PORT_INT)) 
-+              XAAUD->port = XA_AUDIO_PORT_INT;
-+    }
-+  }
-+  OpenBSD_Set_Output_Port(XAAUD->port);
-+}
-+
-+/************* OpenBSD_Headphone_Toggle 
*****************************************
-+ *
-+ * flag = 0  turn headphones off
-+ * flag = 1  turn headphones on
-+ * flag = 2  toggle headphones
-+ ****************************************************************************/
-+void OpenBSD_Headphone_Toggle(flag)
-+xaULONG flag;
-+{ 
-+  switch(flag)
-+  {
-+    case  0: XAAUD->port &= ~XA_AUDIO_PORT_HEAD; break;
-+    case  1: XAAUD->port |=  XA_AUDIO_PORT_HEAD; break;
-+    default:  /* mutually exclusive set for now - never turn off */
-+    { if ( !(XAAUD->port & XA_AUDIO_PORT_HEAD)) 
-+              XAAUD->port = XA_AUDIO_PORT_HEAD;
-+    }
-+  }
-+  OpenBSD_Set_Output_Port(XAAUD->port);
-+}
-+
-+
-+/********** OpenBSD_Adjust_Volume **********************
-+ * Routine for Adjusting Volume on OpenBSD
-+ *
-+ * Volume is in the range [0,XA_AUDIO_MAXVOL]
-+ ****************************************************************************/
-+void OpenBSD_Adjust_Volume(volume)
-+xaULONG volume;
-+{ audio_info_t a_info;
-+
-+  AUDIO_INITINFO(&a_info);
-+  a_info.play.gain = OpenBSD_MIN_VOL +
-+      ((volume * (OpenBSD_MAX_VOL - OpenBSD_MIN_VOL)) / XA_AUDIO_MAXVOL);
-+  if (a_info.play.gain > OpenBSD_MAX_VOL) a_info.play.gain = OpenBSD_MAX_VOL;
-+  ioctl(devAudio, AUDIO_SETINFO, &a_info);
-+
-+}
-+#endif
-+/****************************************************************************/
-+/******************* END OF OpenBSD SPECIFIC ROUTINES 
************************/
-+/****************************************************************************/
-+
-  
/****************************************************************************/
- /**************** TOWNS SPECIFIC ROUTINES ***********************************/
- /****************************************************************************/
-@@ -5828,29 +6225,15 @@
- 
- /*---------------- Now for the Write Segments 
-------------------------------*/
- 
--#ifdef XA_SPARC_AUDIO
-+#ifdef XA_NORMAL_AUDIO_WRITES
-       write(devAudio,xa_audio_ring->buf,xa_audio_ring->len); 
- #endif
- 
--#ifdef XA_NetBSD_AUDIO
--      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
--#endif
--
--#ifdef XA_AIX_AUDIO
--      { int rc;
--        rc = write ( devAudio, xa_audio_ring->buf, xa_audio_ring->len );
--      }
--#endif
--
- #ifdef XA_SGI_AUDIO
-       /* # of Samples, not Bytes. Note: assume 16 bit samples. */
-       ALwritesamps(port,xa_audio_ring->buf, (xa_audio_ring->len >> 1) );
- #endif
- 
--#ifdef XA_LINUX_AUDIO
--      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
--#endif
--
- #ifdef XA_NAS_AUDIO
-       NAS_Write_Data(xa_audio_ring->buf, xa_audio_ring->len);
- #endif
-@@ -5864,10 +6247,6 @@
-       }
- #endif
- 
--#ifdef XA_EWS_AUDIO
--      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
--#endif
--
- #ifdef XA_AF_AUDIO
-       { ATime act, atd = AFtime0;
-       if (XAAUD->mute != xaTRUE)
-@@ -5883,10 +6262,6 @@
- /* Some way to flush streamsocket???? */
- #endif
- 
--#ifdef XA_HPDEV_AUDIO
--      write (devAudio, xa_audio_ring->buf, xa_audio_ring->len);
--#endif
--
- #ifdef XA_MMS_AUDIO
-       /* As currently implemented, this copies the audio data into a separate
-          shared memory buffer for communication with the multimedia server. We
-@@ -5921,10 +6296,6 @@
-         else { mms_buffers_outstanding++; }
-       }
-       }
--#endif
--
--#ifdef XA_TOWNS_AUDIO
--      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
- #endif
- 
- #ifdef XA_TOWNS8_AUDIO
Index: patches/patch-c
===================================================================
RCS file: patches/patch-c
diff -N patches/patch-c
--- patches/patch-c     19 Mar 1999 01:20:48 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,82 +0,0 @@
---- xanim.h.orig       Thu Mar 18 22:09:00 1999
-+++ xanim.h    Thu Mar 18 22:29:48 1999
-@@ -32,10 +32,12 @@
- #else
- #ifndef __CYGWIN32__
- #ifndef __FreeBSD__
-+#ifndef __OpenBSD__
- #include <malloc.h>
- #endif
- #endif
- #endif
-+#endif
- 
- 
- #include <unistd.h>
-@@ -289,6 +291,7 @@
-   xaULONG fromfile;
-   xaULONG bufferit;
-   double scale;
-+  double amp_scale;
-   char *device;
- } XA_AUD_FLAGS;
- 
-@@ -298,30 +301,42 @@
- 
- #ifdef XA_SPARC_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_MMS_AUDIO
- #define XA_AUDIO 1
- #endif
- #ifdef XA_AIX_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_NetBSD_AUDIO
- #define XA_AUDIO 1
-+#define XA_BSD_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
-+#endif
-+#ifdef XA_OpenBSD_AUDIO
-+#define XA_AUDIO 1
-+#define XA_BSD_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_LINUX_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_SGI_AUDIO
- #define XA_AUDIO 1
- #endif
- #ifdef XA_HPDEV_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_HP_AUDIO
- #define XA_AUDIO 1
- #endif
- #ifdef XA_EWS_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_SONY_AUDIO
- #define XA_AUDIO 1
-@@ -334,6 +349,7 @@
- #endif
- #ifdef XA_TOWNS_AUDIO
- #define XA_AUDIO 1
-+#define XA_NORMAL_AUDIO_WRITES 1
- #endif
- #ifdef XA_TOWNS8_AUDIO
- #define XA_AUDIO 1
-@@ -433,6 +449,7 @@
-   xaUBYTE *snd;               /* sound if present */
-   struct XA_SND_STRUCT *prev;
-   struct XA_SND_STRUCT *next;
-+  xaUBYTE volume_boost;
- } XA_SND;
- 
- #define XA_SND_CHUNK_SIZE 65536
Index: patches/patch-d
===================================================================
RCS file: patches/patch-d
diff -N patches/patch-d
--- patches/patch-d     22 Mar 1999 17:34:45 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,153 +0,0 @@
---- xa_acodec.c.orig   Sun Mar 21 23:36:25 1999
-+++ xa_acodec.c        Mon Mar 22 18:03:48 1999
-@@ -198,7 +198,17 @@
-   {
-     if (inc_cnt < (1<<24))
-     { /*** Decode Sample ***/
--      dataL = (spec & 4)?(ibuf[1]):(*ibuf);   
-+         if (snd_hdr->volume_boost)
-+                      {
-+                      unsigned c = snd_hdr->volume_boost;
-+                      unsigned d = 8 - c;
-+                      if (spec & 4)
-+                              dataL = (ibuf[1]<<c) | (ibuf[0]>>d);
-+                      else
-+                              dataL = (ibuf[0]<<c) | (ibuf[1]>>d);
-+                      }
-+              else
-+                      dataL = (spec & 4)?(ibuf[1]):(*ibuf);   
-       ibuf += bps;    byte_cnt += bps;        samp_cnt--;
-       inc_cnt += inc;
-     }
-@@ -1884,6 +1894,19 @@
-   new_snd->inc = inc = (xaULONG)( finc * (double)(1<<24) );
-   new_snd->inc_cnt = 0;
- 
-+  if (vaudiof->amp_scale < 2.0)
-+      new_snd->volume_boost = 0;
-+  else if (vaudiof->amp_scale < 4.0)
-+      new_snd->volume_boost = 1;
-+  else if (vaudiof->amp_scale < 8.0)
-+      new_snd->volume_boost = 2;
-+  else if (vaudiof->amp_scale < 16.0)
-+      new_snd->volume_boost = 3;
-+  else if (vaudiof->amp_scale < 32.0)
-+      new_snd->volume_boost = 4;
-+  else 
-+      new_snd->volume_boost = 5;
-+
-   /* Determine Chunk Time */
-   ftime = ((double)(xa_vaudio_hard_buff) * 1000.0) / (double)(hfreq);
-   new_snd->ch_time = (xaLONG)ftime;
-@@ -2167,6 +2190,7 @@
-       break;
- 
-     case XA_AUDIO_LINEAR_1M:
-+    case XA_AUDIO_SIGNED_1M:
-       {
-       switch(itype)
-       {
-@@ -2183,7 +2207,8 @@
-         case XA_AUDIO_LINEAR_2SL:
-         case XA_AUDIO_LINEAR_2SB:
-               new_snd->spec = 
--                  ((itype & XA_AUDIO_TYPE_MASK)==XA_AUDIO_LINEAR)?(0):(1);
-+                  ((itype & XA_AUDIO_TYPE_MASK)==
-+                              (xa_audio_hard_type & 
XA_AUDIO_TYPE_MASK))?(0):(1);
-               if (itype & XA_AUDIO_BPS_2_MSK)
-                 new_snd->spec |= (itype & XA_AUDIO_BIGEND_MSK)?(2):(4);
-               if (itype & XA_AUDIO_STEREO_MSK)
-@@ -2195,12 +2220,16 @@
-               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
-                       new_snd->spec = 0 | 4 | 8;
-               else    new_snd->spec = 1 | 4 | 8;
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_ULAWx_PCMxM;
-               break;
-         case XA_AUDIO_ULAW:
-               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
-                       new_snd->spec = 0 | 4;
-               else    new_snd->spec = 1 | 4;
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_ULAWx_PCMxM;
-               break;
-         case XA_AUDIO_ALAWS:
-@@ -2218,6 +2247,8 @@
-         case XA_AUDIO_ARMLAWS:
-               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
-                       new_snd->spec = 0 | 4 | 8;
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               else    new_snd->spec = 1 | 4 | 8;
-               new_snd->delta = XA_ADecode_ARMLAWx_PCMxM;
-               break;
-@@ -2226,41 +2257,59 @@
-                       new_snd->spec = 0 | 4;
-               else    new_snd->spec = 1 | 4;
-               new_snd->delta = XA_ADecode_ARMLAWx_PCMxM;
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               break;
-         case XA_AUDIO_ADPCM_M:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_ADPCMM_PCM2M;
-               break;
-         case XA_AUDIO_ADPCM_S:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_ADPCMS_PCM2M;
-               break;
-         case XA_AUDIO_DVI_M:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_DVIM_PCMxM;
-               break;
-         case XA_AUDIO_DVI_S:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_DVIS_PCMxM;
-               break;
-         case XA_AUDIO_IMA4_M:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_IMA4M_PCMxM;
-               break;
-         case XA_AUDIO_IMA4_S:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_IMA4S_PCMxM;
-               break;
- #ifdef XA_GSM
-         case XA_AUDIO_GSM:
-         case XA_AUDIO_MSGSM:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               if (itype == XA_AUDIO_MSGSM_M) new_snd->spec |= 0x80;
-               new_snd->delta = XA_ADecode_GSMM_PCMxM;
-               break;
- #endif
-         case XA_AUDIO_NOP:
--              new_snd->spec = 2 | 4;  /* 1 byte output */
-+              new_snd->spec = 4;  /* 1 byte output */
-+              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
-+                      new_snd->spec |= 2;
-               new_snd->delta = XA_ADecode_NOP_PCMXM;
-               break;
-         default:
Index: patches/patch-e
===================================================================
RCS file: patches/patch-e
diff -N patches/patch-e
--- patches/patch-e     19 Mar 1999 01:20:48 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
---- xanim.c.orig       Thu Mar 18 22:11:25 1999
-+++ xanim.c    Thu Mar 18 22:12:52 1999
-@@ -628,6 +628,7 @@
-  fprintf(stdout,"      Ak    Enables video frame skipping to keep in sync 
with audio.\n");
-  fprintf(stdout,"      Ap#   Play Audio from output port #(Sparc only).\n");
- /* fprintf(stdout,"      As#   Scale Audio playback speed by #.\n"); */
-+ fprintf(stdout,"      AS#   Scale Audio playback amplitude by #.\n");
-  fprintf(stdout,"      Av#   Set Audio volume to #. range 0 to 100.\n");
-  fprintf(stdout,"\n  C[copts]  Color SubMenu\n");
-  fprintf(stdout,"      C1    Create cmap from 1st TrueColor frame. Map\n");
-@@ -861,6 +862,7 @@
- 
-  vaudiof->device              = DEFAULT_AUDIO_DEVICE_NAME;
-  vaudiof->scale               = 1.0;
-+ vaudiof->amp_scale   = 0.0;
-  vaudiof->mute                = xaFALSE;
-  vaudiof->volume              = DEFAULT_XA_AUDIO_VOLUME;
-  if (vaudiof->volume > XA_AUDIO_MAXVOL) vaudiof->volume = XA_AUDIO_MAXVOL;
-@@ -1168,6 +1170,9 @@
-               fprintf(stdout,"XAnim: +As# temporarily disabled.\n");
-               if (vaudiof->scale < 0.125) vaudiof->scale = 0.125;
-               if (vaudiof->scale > 8.000) vaudiof->scale = 8.000;
-+              break;
-+            case 'S':   /* snd amplitude */
-+              j++; vaudiof->amp_scale = XA_Read_Float(in, &j);
-               break;
-             case 'v':
-               j++; vaudiof->volume = XA_Read_Int(in,&j);
Index: patches/patch-f
===================================================================
RCS file: patches/patch-f
diff -N patches/patch-f
--- patches/patch-f     4 Mar 2000 19:00:07 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,115 +0,0 @@
---- Imakefile.orig     Sun Mar 21 23:36:26 1999
-+++ Imakefile  Mon Mar 22 18:13:13 1999
-@@ -96,7 +96,7 @@
- XCOMM   to link against symbols inside xanim.
- XCOMM 
- XCOMM ## Linux
--LD_FLAGS = -rdynamic
-+XCOMM LD_FLAGS = -rdynamic
- XCOMM ## SunOS/Solaris use:
- XCOMM  LD_FLAGS =
- 
-@@ -111,17 +111,17 @@
- XCOMM NOTE: not all machines need the XA_DLL_LIB define.
- XCOMM 
#########################################################################
- XCOMM 
--XA_DLL_DEF = -DXA_DLL -DXA_PRINT
-+XCOMM XA_DLL_DEF = -DXA_DLL -DXA_PRINT
- XCOMM ### Use this only if the above doesn't work
- XCOMM XA_DLL_DEF = -DXA_DLL
- XCOMM
- XCOMM ### You may need this library.
--XA_DLL_LIB = -ldl
-+XCOMM XA_DLL_LIB = -ldl
- XCOMM
- XCOMM If you'd like to change the default directory that XAnim searches while
- XCOMM looking for dlls, then change the directory below.
- XCOMM
--XA_DLL_PATH = /usr/local/xanim/mods
-+XCOMM XA_DLL_PATH = /usr/local/xanim/mods
- 
- 
- 
-@@ -267,8 +267,8 @@
- XCOMM  XA_AUDIO_DEFS =
- XCOMM 
- XCOMM ## -- Linux PCs 
---------------------------------------------------------
--XA_AUDIO_DEFS = -DXA_LINUX_AUDIO
--XA_AUDIO_LIBS = -lc
-+XCOMM XA_AUDIO_DEFS = -DXA_LINUX_AUDIO
-+XCOMM XA_AUDIO_LIBS = -lc
- XCOMM 
- XCOMM  -- Linux PC's with OLD Rev sound drivers 
-------------------------------
- XCOMM  XA_AUDIO_DEFS = -DXA_LINUX_AUDIO -DXA_LINUX_OLDER_SND
-@@ -309,6 +309,9 @@
- XCOMM  -- NetBSD-current (as of 30/April 
1995)---------------------------------
- XCOMM  XA_AUDIO_DEFS = -DXA_NetBSD_AUDIO
- XCOMM 
-+XCOMM  -- OpenBSD, from at least 2.4 to now
-+XA_AUDIO_DEFS = -DXA_OpenBSD_AUDIO
-+XCOMM 
- XCOMM  -- QNX 4.2 PC's 
--------------------------------------------------------
- XCOMM  XA_AUDIO_DEFS = -DXA_LINUX_AUDIO -DXA_SELECT
- XCOMM  XA_AUDIO_LIBS = -lc
-@@ -442,7 +445,7 @@
- XCOMM    -- following symbols(XmbufDisplayBuffers, XmbufQueryExtension,
- XCOMM    --  XmbufCreateBuffers).
- XCOMM    -- NOTE_8: HP-UX machines need to comment this out.
--XCOMM  XA_MULTIBUF = -DXMBUF
-+XA_MULTIBUF = -DXMBUF
- XCOMM 
- XCOMM ###########
- XCOMM 
-@@ -465,7 +468,7 @@
- 
- PROGRAMS = $(XANIM)
- 
--INCLUDES = -I$(INCDIR) $(XA_INCS)
-+INCLUDES = -I/usr/X11R6/include/X11 $(XA_INCS)
- 
-    LIBS1 = $(XA_LIBS) $(EXTENSIONLIB) $(XTOOLLIB) $(XLIB) -lm
- DEPLIBS1 = $(DEPEXTENSIONLIB) $(DEPXTOOLLIB) $(DEPXLIB)
-@@ -504,43 +507,3 @@
- xaclean::
-       $(RM) $(OBJS1)
- 
--
--XCOMM  DO NOT DELETE THIS LINE
--xanim.o: Imakefile xanim.h xa_config.h xa_x11.h xanim.c
--xa1.0_kpcd.o: xa1.0_kpcd.c
--unpacker.o: unpacker.c
--xa_acodec.o: Imakefile xanim.h xa_acodec.c
--xa_act.o: xanim.h xa_config.h xa_act.c
--xa_au.o: xanim.h xa_config.h xa_au.c
--xa_audio.o: Imakefile xanim.h xa_config.h xa_audio.h xa_audio.c
--xa_avi.o: Imakefile xanim.h xa_config.h xa_avi.h xa_codecs.h xa_xmpg.h 
xa_avi.c
--xa_cmap.o: xanim.h xa_config.h xa_cmap.c
--xa_color.o: xanim.h xa_color.c
--xa_dl.o: xanim.h xa_config.h xa_dl.h xa_dl.c
--xa_dumfx.o: xanim.h xa_dumfx.c
--xa_fli.o: xanim.h xa_config.h xa_fli.h xa_fli.c
--xa_formats.o: xanim.h xa_formats.c
--xa_gif.o: xanim.h xa_config.h xa_gif.h xa_gif.c
--xa_iff.o: xanim.h xa_config.h xa_iff.h xa_iff.c
--xa_input.o: xanim.h xa_input.c
--xa_ipc.o: Imakefile xanim.h xa_config.h xa_ipc.h xa_ipc.c
--xa_jmov.o: xanim.h xa_config.h xa_jmov.h xa_jmov.c
--xa_jpg.o: xanim.h xa_config.h xa_jpg.h xa_jpg.c
--xa_j6i.o: xanim.h xa_j6i.h xa_j6i.c
--xa_movi.o: xanim.h xa_config.h xa_movi.h xa_movi.c
--xa_mpg.o: xanim.h xa_config.h xa_mpg.h xa_xmpg.h xa_mpg.c xa_jpg.c
--xa_qt.o: Imakefile xanim.h xa_config.h xa_qt.h xa_codecs.h xa_qt.c
--xa_qt_decs.o: Imakefile xanim.h xa_config.h xa_qt.h xa_qt_decs.c
--xa_vid_codec.o: Imakefile xa_avi.h xa_qt.h xa_codecs.h xavid.h xavid_mod.h
--xa_vid_codec.o: xa_vid_codec.c
--xa_replay.o: xanim.h xa_config.h xa_replay.h xa_replay.c
--xa_rle.o: xanim.h xa_config.h xa_rle.h xa_rle.c
--xa_set.o: xanim.h xa_config.h xa_iff.h xa_iff.c xa_set.h xa_set.c
--xa_raw.o: xanim.h xa_raw.h xa_raw.c
--xa_show.o: Imakefile xanim.h xa_show.c
--xa_txt.o: xanim.h xa_config.h xa_txt.c
--xa_utils.o: xanim.h xa_config.h xa_utils.c
--xa_wav.o: xanim.h xa_config.h xa_avi.h xa_wav.c
--xa_8svx.o: xanim.h xa_8svx.h xa_8svx.c
--xa_x11.o: Imakefile xanim.h xa_config.h xa_x11.h xa_x11.c
--xa_gsm.o: xanim.h xa_gsm_state.h xa_gsm.h xa_gsm.c
Index: patches/patch-xa_acodec_c
===================================================================
RCS file: patches/patch-xa_acodec_c
diff -N patches/patch-xa_acodec_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xa_acodec_c   26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,154 @@
+$OpenBSD$
+--- xa_acodec.c.orig   Sun Mar 21 23:36:25 1999
++++ xa_acodec.c        Fri Jun 26 12:27:44 2015
+@@ -198,7 +198,17 @@ xaULONG ocnt,buff_size;
+   {
+     if (inc_cnt < (1<<24))
+     { /*** Decode Sample ***/
+-      dataL = (spec & 4)?(ibuf[1]):(*ibuf);   
++         if (snd_hdr->volume_boost)
++                      {
++                      unsigned c = snd_hdr->volume_boost;
++                      unsigned d = 8 - c;
++                      if (spec & 4)
++                              dataL = (ibuf[1]<<c) | (ibuf[0]>>d);
++                      else
++                              dataL = (ibuf[0]<<c) | (ibuf[1]>>d);
++                      }
++              else
++                      dataL = (spec & 4)?(ibuf[1]):(*ibuf);   
+       ibuf += bps;    byte_cnt += bps;        samp_cnt--;
+       inc_cnt += inc;
+     }
+@@ -1884,6 +1894,19 @@ DEBUG_LEVEL1
+   new_snd->inc = inc = (xaULONG)( finc * (double)(1<<24) );
+   new_snd->inc_cnt = 0;
+ 
++  if (vaudiof->amp_scale < 2.0)
++      new_snd->volume_boost = 0;
++  else if (vaudiof->amp_scale < 4.0)
++      new_snd->volume_boost = 1;
++  else if (vaudiof->amp_scale < 8.0)
++      new_snd->volume_boost = 2;
++  else if (vaudiof->amp_scale < 16.0)
++      new_snd->volume_boost = 3;
++  else if (vaudiof->amp_scale < 32.0)
++      new_snd->volume_boost = 4;
++  else 
++      new_snd->volume_boost = 5;
++
+   /* Determine Chunk Time */
+   ftime = ((double)(xa_vaudio_hard_buff) * 1000.0) / (double)(hfreq);
+   new_snd->ch_time = (xaLONG)ftime;
+@@ -2167,6 +2190,7 @@ fprintf(stderr,"XA_IPC_Sound itype %x\n",itype);
+       break;
+ 
+     case XA_AUDIO_LINEAR_1M:
++    case XA_AUDIO_SIGNED_1M:
+       {
+       switch(itype)
+       {
+@@ -2183,7 +2207,8 @@ fprintf(stderr,"XA_IPC_Sound itype %x\n",itype);
+         case XA_AUDIO_LINEAR_2SL:
+         case XA_AUDIO_LINEAR_2SB:
+               new_snd->spec = 
+-                  ((itype & XA_AUDIO_TYPE_MASK)==XA_AUDIO_LINEAR)?(0):(1);
++                  ((itype & XA_AUDIO_TYPE_MASK)==
++                              (xa_audio_hard_type & 
XA_AUDIO_TYPE_MASK))?(0):(1);
+               if (itype & XA_AUDIO_BPS_2_MSK)
+                 new_snd->spec |= (itype & XA_AUDIO_BIGEND_MSK)?(2):(4);
+               if (itype & XA_AUDIO_STEREO_MSK)
+@@ -2195,12 +2220,16 @@ fprintf(stderr,"XA_IPC_Sound itype %x\n",itype);
+               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
+                       new_snd->spec = 0 | 4 | 8;
+               else    new_snd->spec = 1 | 4 | 8;
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_ULAWx_PCMxM;
+               break;
+         case XA_AUDIO_ULAW:
+               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
+                       new_snd->spec = 0 | 4;
+               else    new_snd->spec = 1 | 4;
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_ULAWx_PCMxM;
+               break;
+         case XA_AUDIO_ALAWS:
+@@ -2218,6 +2247,8 @@ fprintf(stderr,"XA_IPC_Sound itype %x\n",itype);
+         case XA_AUDIO_ARMLAWS:
+               if (xa_audio_hard_type & XA_AUDIO_BIGEND_MSK)
+                       new_snd->spec = 0 | 4 | 8;
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               else    new_snd->spec = 1 | 4 | 8;
+               new_snd->delta = XA_ADecode_ARMLAWx_PCMxM;
+               break;
+@@ -2226,41 +2257,59 @@ fprintf(stderr,"XA_IPC_Sound itype %x\n",itype);
+                       new_snd->spec = 0 | 4;
+               else    new_snd->spec = 1 | 4;
+               new_snd->delta = XA_ADecode_ARMLAWx_PCMxM;
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               break;
+         case XA_AUDIO_ADPCM_M:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_ADPCMM_PCM2M;
+               break;
+         case XA_AUDIO_ADPCM_S:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_ADPCMS_PCM2M;
+               break;
+         case XA_AUDIO_DVI_M:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_DVIM_PCMxM;
+               break;
+         case XA_AUDIO_DVI_S:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_DVIS_PCMxM;
+               break;
+         case XA_AUDIO_IMA4_M:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_IMA4M_PCMxM;
+               break;
+         case XA_AUDIO_IMA4_S:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_IMA4S_PCMxM;
+               break;
+ #ifdef XA_GSM
+         case XA_AUDIO_GSM:
+         case XA_AUDIO_MSGSM:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               if (itype == XA_AUDIO_MSGSM_M) new_snd->spec |= 0x80;
+               new_snd->delta = XA_ADecode_GSMM_PCMxM;
+               break;
+ #endif
+         case XA_AUDIO_NOP:
+-              new_snd->spec = 2 | 4;  /* 1 byte output */
++              new_snd->spec = 4;  /* 1 byte output */
++              if (xa_audio_hard_type == XA_AUDIO_LINEAR_1M)
++                      new_snd->spec |= 2;
+               new_snd->delta = XA_ADecode_NOP_PCMXM;
+               break;
+         default:
Index: patches/patch-xa_audio_c
===================================================================
RCS file: patches/patch-xa_audio_c
diff -N patches/patch-xa_audio_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xa_audio_c    26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,372 @@
+$OpenBSD$
+--- xa_audio.c.orig    Sun Mar 21 23:36:25 1999
++++ xa_audio.c Fri Jun 26 13:03:03 2015
+@@ -114,6 +114,7 @@
+  * 21Feb99 - Added routine *_Audio_Prep  to hide initialization delays
+  *         when starting audio.
+  * 02Mar99 - Linux: Change XA_LINUX_NEWER_SND TO OLDER_SND to avoid confusion.
++ * 18Mar99 - OpenBSD: newer configuration, solves a few problems.
+  *
+  ****************************************************************************/
+ 
+@@ -4936,6 +4937,294 @@ xaULONG volume;
+ /******************* END OF NetBSD SPECIFIC ROUTINES ************************/
+ /****************************************************************************/
+ 
++/****************************************************************************/
++/**************** OpenBSD SPECIFIC ROUTINES *********************************/
++/****************************************************************************/
++
++/*
++ * Based on the NetBSD port initially, 
++ * contributed by Marc Espie <[email protected]>
++ * This code may actually work on NetBSD, but this is not my place to
++ * change this.
++ *
++ * This code tries not to abuse AUDIO_SETINFO, as this can be an expensive
++ * ioctl on some arches. Also, it is able to deal with weirder audio
++ * devices, such as those found on amiga or sparcs.
++ */
++
++#ifdef XA_OpenBSD_AUDIO
++
++void  OpenBSD_Audio_Init();
++void  OpenBSD_Audio_Kill();
++void  OpenBSD_Audio_Off();
++void  OpenBSD_Audio_Prep();
++void  OpenBSD_Audio_On();
++void  OpenBSD_Adjust_Volume();
++xaULONG OpenBSD_Closest_Freq();
++void OpenBSD_Set_Output_Port();
++void OpenBSD_Speaker_Toggle();
++void OpenBSD_Headphone_Toggle();
++
++#define OpenBSD_MAX_VOL AUDIO_MAX_GAIN
++#define OpenBSD_MIN_VOL AUDIO_MIN_GAIN
++
++static int devAudio;
++
++/********** XA_Audio_Setup **********************
++ * 
++ * Also defines OpenBSD Specific variables.
++ *
++ *****/
++void XA_Audio_Setup()
++{
++  XA_Audio_Init               = OpenBSD_Audio_Init;
++  XA_Audio_Kill               = OpenBSD_Audio_Kill;
++  XA_Audio_Off                = OpenBSD_Audio_Off;
++  XA_Audio_Prep               = OpenBSD_Audio_Prep;
++  XA_Audio_On         = OpenBSD_Audio_On;
++  XA_Closest_Freq     = OpenBSD_Closest_Freq;
++  XA_Set_Output_Port  = OpenBSD_Set_Output_Port;
++  XA_Speaker_Tog      = OpenBSD_Speaker_Toggle;
++  XA_Headphone_Tog    = OpenBSD_Headphone_Toggle;
++  XA_LineOut_Tog      = OpenBSD_Headphone_Toggle;
++  XA_Adjust_Volume    = OpenBSD_Adjust_Volume;
++
++  xa_snd_cur = 0;
++  xa_audio_present = XA_AUDIO_UNK;
++  xa_audio_status  = XA_AUDIO_STOPPED;
++  xa_audio_ring_size  = 8;
++}
++
++/********** OpenBSD_Audio_Init **********************
++ * Open /dev/audio and OpenBSD.
++ *
++ *****/
++
++static struct sio_hdl *hdl = NULL;
++
++void OpenBSD_Audio_Init()
++{
++  struct sio_par par;
++
++  if (xa_audio_present != XA_AUDIO_UNK) return;
++  hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++  if (hdl == NULL)
++  {
++    fprintf(stderr,"Audio_Init: Error opening audio device. - ");
++    fprintf(stderr,"Will continue without audio\n");
++    xa_audio_present = XA_AUDIO_ERR;
++    return;
++  }
++
++  DEBUG_LEVEL1 fprintf(stderr,"OpenBSD AUDIO\n");
++
++  sio_initpar(&par);
++  par.appbufsz = 1024;
++  par.rate = 11025;   /* this is changed later */
++  par.pchan = 1;
++  par.bits = 16;
++  par.le = SIO_LE_NATIVE;
++  par.sig = 1;
++  if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++    fprintf(stderr,"Audio_Init: Error setting audio parameters\n");
++    xa_audio_present = XA_AUDIO_ERR;
++    return;
++  }
++  if ((par.pchan != 1 && par.pchan != 2) ||
++      (par.bits != 8 && par.bits != 16)) {
++    fprintf(stderr,"Audio_Init: Unsupported audio parameters\n");
++    xa_audio_present = XA_AUDIO_ERR;
++    return;
++  }
++  if (par.pchan == 1) {
++    if (par.bits == 8) {
++      xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_1M : XA_AUDIO_LINEAR_1M;
++    } else {
++      if (par.le)
++        xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_2ML : 
XA_AUDIO_LINEAR_2ML;
++      else
++        xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_2MB : 
XA_AUDIO_LINEAR_2MB;
++    }
++  } else {
++    if (par.bits == 8) {
++      xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_1S : XA_AUDIO_LINEAR_1S;
++    } else {
++      if (par.le)
++        xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_2SL : 
XA_AUDIO_LINEAR_2SL;
++      else
++        xa_audio_hard_type = par.sig ? XA_AUDIO_SIGNED_2SB : 
XA_AUDIO_LINEAR_2SB;
++    }
++  }
++  xa_audio_hard_freq  = par.rate;
++  xa_audio_hard_buff  = par.appbufsz;
++  xa_audio_hard_bps   = par.bps;
++  xa_audio_hard_chans = par.pchan;
++  xa_interval_id = 0;
++  xa_audio_present = XA_AUDIO_OK;
++  DEBUG_LEVEL2 fprintf(stderr,"   success \n");
++  Init_Audio_Ring(xa_audio_ring_size,
++                      (XA_AUDIO_MAX_RING_BUFF * xa_audio_hard_bps) );
++}
++
++/********** OpenBSD_Audio_Kill **********************
++ * Close /dev/audio.
++ *
++ *****/
++void OpenBSD_Audio_Kill()
++{ 
++  OpenBSD_Audio_Off(0);
++  xa_audio_present = XA_AUDIO_UNK;
++  sio_close(hdl);
++  Kill_Audio_Ring();
++}
++
++/********** OpenBSD_Audio_Off **********************
++ * Stop Audio Stream
++ *
++ *****/
++void OpenBSD_Audio_Off(flag)
++xaULONG flag;
++{ /* long ret; */
++
++  DEBUG_LEVEL1
++    fprintf(stderr,"OpenBSD_Audio_Off\n");
++  if (xa_audio_status != XA_AUDIO_STARTED) return;
++
++  /* SET FLAG TO STOP OUTPUT ROUTINE */
++  xa_audio_status = XA_AUDIO_STOPPED;
++
++  if (!sio_stop(hdl)) {
++    fprintf(stderr,"Audio_Off: Error stopping device\n");
++    xa_audio_present = XA_AUDIO_ERR;
++    return;
++  }
++
++  xa_time_audio = -1;
++  xa_audio_flushed = 0;
++}
++
++/********** OpenBSD_Audio_Prep **********************
++ * Turn On Audio Stream.
++ *
++ *****/
++void OpenBSD_Audio_Prep()
++{
++  struct sio_par par;
++
++  DEBUG_LEVEL2 
++    fprintf(stderr,"OpenBSD_Audio_Prep \n");
++  if (xa_audio_status == XA_AUDIO_STARTED) return;
++  else if (xa_audio_present != XA_AUDIO_OK) return;
++
++  else if (xa_snd_cur)
++  {
++    sio_initpar(&par);
++    par.rate = xa_snd_cur->hfreq;
++    if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++      fprintf(stderr,"Audio_Init: Error setting audio parameters\n");
++      xa_audio_present = XA_AUDIO_ERR;
++      return;
++    }
++    xa_audio_hard_freq = par.rate;
++
++    /* xa_snd_cur gets changes in Update_Ring() */
++    xa_out_time = 100;  /* keep audio fed 500ms ahead of video */  /* was 
500, changed it to 100 - rcd */
++    xa_out_init = xa_audio_ring_size - 1;
++    xa_interval_time = xa_snd_cur->ch_time / XAAUD->divtest;
++    if (xa_interval_time == 0) xa_interval_time = 1;
++
++    XA_Flush_Ring();
++    XA_Update_Ring(1000);
++    xa_audio_status = XA_AUDIO_PREPPED;
++  }
++}
++
++/****-------------------------------------------------------------------****
++ *
++ ****-------------------------------------------------------------------****/
++void OpenBSD_Audio_On()
++{
++  DEBUG_LEVEL1
++    fprintf(stderr,"OpenBSD_Audio_On\n");
++  if (   (xa_snd_cur)
++      && (xa_audio_present == XA_AUDIO_OK)
++      && (xa_audio_status == XA_AUDIO_PREPPED) )
++  { 
++    DEBUG_LEVEL1
++      fprintf(stderr,"OpenBSD_Audio_On: starting\n");
++    xa_audio_status = XA_AUDIO_STARTED;
++    if (!sio_start(hdl)) {
++      fprintf(stderr,"Audio_Init: Error starting audio device\n");
++      xa_audio_present = XA_AUDIO_ERR;
++      return;
++    }
++    xa_time_now = XA_Read_AV_Time();  /* get new time */
++    New_Merged_Audio_Output();
++  }
++}
++
++/********** OpenBSD_Closest_Freq 
**********************************************
++ *
++ * Global Variable Affect:
++ *   xaULONG xa_audio_hard_buff               must set but not larger than
++ *                                    XA_AUDIO_MAX_RING_BUF size
++ ****************************************************************************/
++xaULONG OpenBSD_Closest_Freq(ifreq)
++xaLONG ifreq;
++{ 
++  return ifreq;
++}
++
++/* Eventually merge everything to one */
++void OpenBSD_Set_Output_Port(aud_ports)
++xaULONG aud_ports;
++{
++}
++
++/************* OpenBSD_Speaker_Toggle 
*****************************************
++ *
++ * flag = 0  turn speaker off
++ * flag = 1  turn speaker on
++ * flag = 2  toggle speaker
++ ****************************************************************************/
++void OpenBSD_Speaker_Toggle(flag)
++xaULONG flag;
++{ 
++}
++
++/************* OpenBSD_Headphone_Toggle 
*****************************************
++ *
++ * flag = 0  turn headphones off
++ * flag = 1  turn headphones on
++ * flag = 2  toggle headphones
++ ****************************************************************************/
++void OpenBSD_Headphone_Toggle(flag)
++xaULONG flag;
++{ 
++}
++
++
++/********** OpenBSD_Adjust_Volume **********************
++ * Routine for Adjusting Volume on OpenBSD
++ *
++ * Volume is in the range [0,XA_AUDIO_MAXVOL]
++ ****************************************************************************/
++void OpenBSD_Adjust_Volume(volume)
++xaULONG volume;
++{
++  DEBUG_LEVEL1
++    printf(stderr,"OpenBSD_Setvo: %d\n", volume);
++#if 0 /* not_yet, xanim sets initial volume too low */
++  if (hdl)
++    sio_setvol(hdl, volume * SIO_MAXVOL / XA_AUDIO_MAXVOL);
++#endif
++}
++#endif
++
++/****************************************************************************/
++/******************* END OF OpenBSD SPECIFIC ROUTINES 
************************/
++/****************************************************************************/
++
+  
/****************************************************************************/
+ /**************** TOWNS SPECIFIC ROUTINES ***********************************/
+ /****************************************************************************/
+@@ -5828,29 +6117,19 @@ void New_Merged_Audio_Output()
+ 
+ /*---------------- Now for the Write Segments 
-------------------------------*/
+ 
+-#ifdef XA_SPARC_AUDIO
++#ifdef XA_NORMAL_AUDIO_WRITES
+       write(devAudio,xa_audio_ring->buf,xa_audio_ring->len); 
+ #endif
+ 
+-#ifdef XA_NetBSD_AUDIO
+-      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
++#ifdef XA_OpenBSD_AUDIO
++      sio_write(hdl, xa_audio_ring->buf, xa_audio_ring->len);
+ #endif
+ 
+-#ifdef XA_AIX_AUDIO
+-      { int rc;
+-        rc = write ( devAudio, xa_audio_ring->buf, xa_audio_ring->len );
+-      }
+-#endif
+-
+ #ifdef XA_SGI_AUDIO
+       /* # of Samples, not Bytes. Note: assume 16 bit samples. */
+       ALwritesamps(port,xa_audio_ring->buf, (xa_audio_ring->len >> 1) );
+ #endif
+ 
+-#ifdef XA_LINUX_AUDIO
+-      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
+-#endif
+-
+ #ifdef XA_NAS_AUDIO
+       NAS_Write_Data(xa_audio_ring->buf, xa_audio_ring->len);
+ #endif
+@@ -5864,10 +6143,6 @@ void New_Merged_Audio_Output()
+       }
+ #endif
+ 
+-#ifdef XA_EWS_AUDIO
+-      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
+-#endif
+-
+ #ifdef XA_AF_AUDIO
+       { ATime act, atd = AFtime0;
+       if (XAAUD->mute != xaTRUE)
+@@ -5883,10 +6158,6 @@ void New_Merged_Audio_Output()
+ /* Some way to flush streamsocket???? */
+ #endif
+ 
+-#ifdef XA_HPDEV_AUDIO
+-      write (devAudio, xa_audio_ring->buf, xa_audio_ring->len);
+-#endif
+-
+ #ifdef XA_MMS_AUDIO
+       /* As currently implemented, this copies the audio data into a separate
+          shared memory buffer for communication with the multimedia server. We
+@@ -5921,10 +6192,6 @@ void New_Merged_Audio_Output()
+         else { mms_buffers_outstanding++; }
+       }
+       }
+-#endif
+-
+-#ifdef XA_TOWNS_AUDIO
+-      write(devAudio,xa_audio_ring->buf,xa_audio_ring->len);
+ #endif
+ 
+ #ifdef XA_TOWNS8_AUDIO
Index: patches/patch-xa_audio_h
===================================================================
RCS file: patches/patch-xa_audio_h
diff -N patches/patch-xa_audio_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xa_audio_h    26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+--- xa_audio.h.orig    Sun Mar 21 23:36:25 1999
++++ xa_audio.h Fri Jun 26 12:29:20 2015
+@@ -114,6 +114,10 @@ extern xaULONG xa_forkit;
+ #include <sys/ioccom.h>
+ #endif
+ 
++/*********************** OpenBSD INCLUDES *******************************/
++#ifdef XA_OpenBSD_AUDIO
++#include <sndio.h>
++#endif
+ 
+ /*********************** LINUX INCLUDES ********************************/
+ #ifdef XA_LINUX_AUDIO
Index: patches/patch-xanim_c
===================================================================
RCS file: patches/patch-xanim_c
diff -N patches/patch-xanim_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xanim_c       26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+--- xanim.c.orig       Sun Mar 21 23:36:25 1999
++++ xanim.c    Fri Jun 26 12:27:44 2015
+@@ -628,6 +628,7 @@ void Usage()
+  fprintf(stdout,"      Ak    Enables video frame skipping to keep in sync 
with audio.\n");
+  fprintf(stdout,"      Ap#   Play Audio from output port #(Sparc only).\n");
+ /* fprintf(stdout,"      As#   Scale Audio playback speed by #.\n"); */
++ fprintf(stdout,"      AS#   Scale Audio playback amplitude by #.\n");
+  fprintf(stdout,"      Av#   Set Audio volume to #. range 0 to 100.\n");
+  fprintf(stdout,"\n  C[copts]  Color SubMenu\n");
+  fprintf(stdout,"      C1    Create cmap from 1st TrueColor frame. Map\n");
+@@ -861,6 +862,7 @@ char *argv[];
+ 
+  vaudiof->device              = DEFAULT_AUDIO_DEVICE_NAME;
+  vaudiof->scale               = 1.0;
++ vaudiof->amp_scale   = 0.0;
+  vaudiof->mute                = xaFALSE;
+  vaudiof->volume              = DEFAULT_XA_AUDIO_VOLUME;
+  if (vaudiof->volume > XA_AUDIO_MAXVOL) vaudiof->volume = XA_AUDIO_MAXVOL;
+@@ -1168,6 +1170,9 @@ char *argv[];
+               fprintf(stdout,"XAnim: +As# temporarily disabled.\n");
+               if (vaudiof->scale < 0.125) vaudiof->scale = 0.125;
+               if (vaudiof->scale > 8.000) vaudiof->scale = 8.000;
++              break;
++            case 'S':   /* snd amplitude */
++              j++; vaudiof->amp_scale = XA_Read_Float(in, &j);
+               break;
+             case 'v':
+               j++; vaudiof->volume = XA_Read_Int(in,&j);
Index: patches/patch-xanim_h
===================================================================
RCS file: patches/patch-xanim_h
diff -N patches/patch-xanim_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-xanim_h       26 Jun 2015 15:37:46 -0000
@@ -0,0 +1,83 @@
+$OpenBSD$
+--- xanim.h.orig       Sun Mar 21 23:36:26 1999
++++ xanim.h    Fri Jun 26 12:45:23 2015
+@@ -32,10 +32,12 @@
+ #else
+ #ifndef __CYGWIN32__
+ #ifndef __FreeBSD__
++#ifndef __OpenBSD__
+ #include <malloc.h>
+ #endif
+ #endif
+ #endif
++#endif
+ 
+ 
+ #include <unistd.h>
+@@ -289,6 +291,7 @@ typedef struct
+   xaULONG fromfile;
+   xaULONG bufferit;
+   double scale;
++  double amp_scale;
+   char *device;
+ } XA_AUD_FLAGS;
+ 
+@@ -298,30 +301,42 @@ typedef struct
+ 
+ #ifdef XA_SPARC_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_MMS_AUDIO
+ #define XA_AUDIO 1
+ #endif
+ #ifdef XA_AIX_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_NetBSD_AUDIO
+ #define XA_AUDIO 1
++#define XA_BSD_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
++#ifdef XA_OpenBSD_AUDIO
++#define XA_AUDIO 1
++#define XA_BSD_AUDIO 1
++//#define XA_NORMAL_AUDIO_WRITES 1
++#endif
+ #ifdef XA_LINUX_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_SGI_AUDIO
+ #define XA_AUDIO 1
+ #endif
+ #ifdef XA_HPDEV_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_HP_AUDIO
+ #define XA_AUDIO 1
+ #endif
+ #ifdef XA_EWS_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_SONY_AUDIO
+ #define XA_AUDIO 1
+@@ -334,6 +349,7 @@ typedef struct
+ #endif
+ #ifdef XA_TOWNS_AUDIO
+ #define XA_AUDIO 1
++#define XA_NORMAL_AUDIO_WRITES 1
+ #endif
+ #ifdef XA_TOWNS8_AUDIO
+ #define XA_AUDIO 1
+@@ -433,6 +449,7 @@ typedef struct XA_SND_STRUCT
+   xaUBYTE *snd;               /* sound if present */
+   struct XA_SND_STRUCT *prev;
+   struct XA_SND_STRUCT *next;
++  xaUBYTE volume_boost;
+ } XA_SND;
+ 
+ #define XA_SND_CHUNK_SIZE 65536

Reply via email to