-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /home2/cvs/OpenBSD/ports/audio/fluidsynth/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile    20 Apr 2008 11:19:20 -0000      1.2
+++ Makefile    12 Dec 2008 12:28:03 -0000
@@ -2,7 +2,7 @@
 
 COMMENT =              SoundFont2 software synthesizer
 DISTNAME =             fluidsynth-1.0.8
-PKGNAME =              ${DISTNAME}p0
+PKGNAME =              ${DISTNAME}p1
 
 SHARED_LIBS =          fluidsynth      0.0
 
@@ -17,7 +17,7 @@
 PERMIT_DISTFILES_CDROM = Yes
 PERMIT_DISTFILES_FTP = Yes
 
-WANTLIB =              c m ncurses ossaudio pthread readline
+WANTLIB =              c m ncurses ossaudio pthread readline sndio
 
 MASTER_SITES =         http://download.savannah.gnu.org/releases/fluid/
 
@@ -27,10 +27,23 @@
 
 LIB_DEPENDS =          jack::audio/jack
 
+AUTOCONF_VERSION =     2.61
+AUTOMAKE_VERSION =     1.9
+
+BUILD_DEPENDS +=       ${MODGNU_AUTOCONF_DEPENDS} \
+                       ${MODGNU_AUTOMAKE_DEPENDS}
+
 USE_LIBTOOL =          Yes
 CONFIGURE_STYLE =      gnu
 CONFIGURE_ARGS +=      ${CONFIGURE_SHARED} \
                        --disable-lash \
                        --disable-ladcca
+
+post-patch:
+       cp ${FILESDIR}/fluid_libsndio.c ${WRKSRC}/src/
+
+pre-configure:
+       cd ${WRKSRC} && AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
+           AUTOCONF_VERSION=${AUTOCONF_VERSION} ./autogen.sh
 
 .include <bsd.port.mk>
Index: files/fluid_libsndio.c
===================================================================
RCS file: files/fluid_libsndio.c
diff -N files/fluid_libsndio.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/fluid_libsndio.c      12 Dec 2008 12:28:03 -0000
@@ -0,0 +1,372 @@
+/* libsndio backend for FluidSynth - A Software Synthesizer
+ *
+ * Copyright (c) 2008 Jacob Meuser <jake...@sdf.lonestar.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+/* fluid_libsndio.c
+ *
+ * Driver for the libsndio audio access library
+ */
+
+#include "fluid_synth.h"
+#include "fluid_adriver.h"
+#include "fluid_settings.h"
+
+#if LIBSNDIO_SUPPORT
+
+#include <sndio.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <unistd.h>
+
+
+/** fluid_libsndio_audio_driver_t
+ *
+ * This structure should not be accessed directly. Use audio port
+ * functions instead.
+ */
+typedef struct {
+  fluid_audio_driver_t driver;
+  fluid_synth_t* synth;
+  fluid_audio_callback_t read;
+  void* buffer;
+  pthread_t thread;
+  int cont;
+  struct sio_hdl *hdl;
+  struct sio_par par;
+  int buffer_size;
+  int buffer_byte_size;
+  fluid_audio_func_t callback;
+  void* data;
+  float* buffers[2];
+} fluid_libsndio_audio_driver_t;
+
+int delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p);
+
+/* local utilities */
+static void* fluid_libsndio_audio_run(void* d);
+static void* fluid_libsndio_audio_run2(void* d);
+
+
+void
+fluid_libsndio_audio_driver_settings(fluid_settings_t* settings)
+{
+  fluid_settings_register_str(settings, "audio.libsndio.device", NULL, 0, 
NULL, NULL);
+}
+
+/*
+ * new_fluid_libsndio_audio_driver
+ */
+fluid_audio_driver_t*
+new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* 
synth)
+{
+  fluid_libsndio_audio_driver_t* dev = NULL;
+  int queuesize;
+  double sample_rate;
+  int periods, period_size;
+  char* devname;
+  pthread_attr_t attr;
+  int err;
+
+  dev = FLUID_NEW(fluid_libsndio_audio_driver_t);
+  if (dev == NULL) {
+    FLUID_LOG(FLUID_ERR, "Out of memory");
+    return NULL;
+  }
+  FLUID_MEMSET(dev, 0, sizeof(fluid_libsndio_audio_driver_t));
+
+  fluid_settings_getint(settings, "audio.periods", &periods);
+  fluid_settings_getint(settings, "audio.period-size", &period_size);
+  fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate);
+
+  dev->hdl = NULL;
+  dev->synth = synth;
+  dev->callback = NULL;
+  dev->data = NULL;
+  dev->cont = 1;
+  dev->buffer_size = (int) period_size;
+  queuesize = (int) (periods * period_size);
+
+  if (!fluid_settings_getstr(settings, "audio.libsndio.device", &devname)) {
+    devname = NULL;
+  }
+
+  dev->hdl = sio_open(devname, SIO_PLAY, 0);
+  if (dev->hdl == NULL) {
+    FLUID_LOG(FLUID_ERR, "libsndio could not be opened for writing");
+    goto error_recovery;
+  }
+
+  sio_initpar(&dev->par);
+
+  if (fluid_settings_str_equal(settings, "audio.sample-format", "16bits")) {
+    dev->par.bits = 16;
+#ifdef WORDS_BIGENDIAN
+    dev->par.le = 0;
+#else
+    dev->par.le = 1;
+#endif
+    dev->read = fluid_synth_write_s16;
+    dev->buffer_byte_size = dev->buffer_size * 4;
+
+  } else {
+    FLUID_LOG(FLUID_ERR, "Unknown sample format");
+    goto error_recovery;
+  }
+
+  dev->buffer = FLUID_MALLOC(dev->buffer_byte_size);
+  if (dev->buffer == NULL) {
+    FLUID_LOG(FLUID_ERR, "Out of memory");
+    goto error_recovery;
+  }
+
+  dev->par.bufsz = dev->buffer_size * periods;
+  dev->par.round = dev->buffer_size;
+
+  dev->par.pchan = 2;
+  dev->par.rate = sample_rate;
+
+  if (!sio_setpar(dev->hdl, &dev->par)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't set libsndio audio parameters");
+    goto error_recovery;
+  }
+
+  if (!sio_getpar(dev->hdl, &dev->par)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't get libsndio audio parameters");
+    goto error_recovery;
+  } else if (dev->par.pchan != 2 || dev->par.rate != sample_rate ||
+      dev->par.bits != 16) {
+    FLUID_LOG(FLUID_ERR, "Couldn't set libsndio audio parameters as desired");
+    goto error_recovery;
+  }
+
+  if (!sio_start(dev->hdl)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't start libsndio");
+    goto error_recovery;
+  }
+
+  if (pthread_attr_init(&attr)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't initialize audio thread attributes");
+    goto error_recovery;
+  }
+
+  err = pthread_create(&dev->thread, &attr, fluid_libsndio_audio_run, (void*) 
dev);
+  if (err) {
+    FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
+    goto error_recovery;
+  }
+
+  return (fluid_audio_driver_t*) dev;
+
+error_recovery:
+  delete_fluid_libsndio_audio_driver((fluid_audio_driver_t*) dev);
+  return NULL;
+}
+
+fluid_audio_driver_t*
+new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, 
fluid_audio_func_t func, void* data)
+{
+  fluid_libsndio_audio_driver_t* dev = NULL;
+  int queuesize;
+  double sample_rate;
+  int periods, period_size;
+  char* devname;
+  pthread_attr_t attr;
+  int err;
+
+  dev = FLUID_NEW(fluid_libsndio_audio_driver_t);
+  if (dev == NULL) {
+    FLUID_LOG(FLUID_ERR, "Out of memory");
+    return NULL;
+  }
+  FLUID_MEMSET(dev, 0, sizeof(fluid_libsndio_audio_driver_t));
+
+  fluid_settings_getint(settings, "audio.periods", &periods);
+  fluid_settings_getint(settings, "audio.period-size", &period_size);
+  fluid_settings_getnum(settings, "synth.sample-rate", &sample_rate);
+
+  dev->hdl = NULL;
+  dev->synth = NULL;
+  dev->read = NULL;
+  dev->callback = func;
+  dev->data = data;
+  dev->cont = 1;
+  dev->buffer_size = (int) period_size;
+  queuesize = (int) (periods * period_size);
+  dev->buffer_byte_size = dev->buffer_size * 2 * 2; /* 2 channels * 16 bits 
audio */
+
+  if (!fluid_settings_getstr(settings, "audio.libsndio.device", &devname)) {
+    devname = NULL;
+  }
+
+  dev->hdl = sio_open(devname, SIO_PLAY, 0);
+  if (dev->hdl == NULL) {
+    FLUID_LOG(FLUID_ERR, "libsndio could not be opened for writing");
+    goto error_recovery;
+  }
+
+  sio_initpar(&dev->par);
+
+  dev->par.bufsz = dev->buffer_size * periods;
+  dev->par.round = dev->buffer_size;
+
+  dev->par.bits = 16;
+#ifdef WORDS_BIGENDIAN
+  dev->par.le = 0;
+#else
+  dev->par.le = 1;
+#endif
+
+  dev->par.pchan = 2;
+  dev->par.rate = sample_rate;
+
+  if (!sio_setpar(dev->hdl, &dev->par)){
+    FLUID_LOG(FLUID_ERR, "Can't configure libsndio parameters");
+    goto error_recovery;
+  }
+
+  if (!sio_getpar(dev->hdl, &dev->par)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't get libsndio audio parameters");
+    goto error_recovery;
+  } else if (dev->par.pchan != 2 || dev->par.rate != sample_rate ||
+      dev->par.bits != 16) {
+    FLUID_LOG(FLUID_ERR, "Couldn't set libsndio audio parameters as desired");
+    goto error_recovery;
+  }
+
+  /* allocate the buffers. FIXME!!! don't use interleaved samples */
+  dev->buffer = FLUID_MALLOC(dev->buffer_byte_size);
+  dev->buffers[0] = FLUID_ARRAY(float, dev->buffer_size);
+  dev->buffers[1] = FLUID_ARRAY(float, dev->buffer_size);
+  if ((dev->buffer == NULL) || (dev->buffers[0] == NULL) || (dev->buffers[1] 
== NULL)) {
+    FLUID_LOG(FLUID_ERR, "Out of memory");
+    goto error_recovery;
+  }
+
+  if (!sio_start(dev->hdl)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't start libsndio");
+    goto error_recovery;
+  }
+
+  if (pthread_attr_init(&attr)) {
+    FLUID_LOG(FLUID_ERR, "Couldn't initialize audio thread attributes");
+    goto error_recovery;
+  }
+
+  err = pthread_create(&dev->thread, &attr, fluid_libsndio_audio_run2, (void*) 
dev);
+  if (err) {
+    FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
+    goto error_recovery;
+  }
+
+  return (fluid_audio_driver_t*) dev;
+
+error_recovery:
+  delete_fluid_libsndio_audio_driver((fluid_audio_driver_t*) dev);
+  return NULL;
+}
+
+/*
+ * delete_fluid_libsndio_audio_driver
+ */
+int
+delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p)
+{
+  fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) p;
+
+  if (dev == NULL) {
+    return FLUID_OK;
+  }
+  dev->cont = 0;
+  if (dev->thread) {
+    if (pthread_join(dev->thread, NULL)) {
+      FLUID_LOG(FLUID_ERR, "Failed to join the audio thread");
+      return FLUID_FAILED;
+    }
+  }
+  if (dev->hdl) {
+    sio_close(dev->hdl);
+  }
+  if (dev->buffer != NULL) {
+    FLUID_FREE(dev->buffer);
+  }
+  FLUID_FREE(dev);
+  return FLUID_OK;
+}
+
+/*
+ * fluid_libsndio_audio_run
+ */
+void*
+fluid_libsndio_audio_run(void* d)
+{
+  fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) d;
+  fluid_synth_t* synth = dev->synth;
+  void* buffer = dev->buffer;
+  int len = dev->buffer_size;
+
+  /* it's as simple as that: */
+  while (dev->cont)
+  {
+    dev->read (synth, len, buffer, 0, 2, buffer, 1, 2);
+    sio_write (dev->hdl, buffer, dev->buffer_byte_size);
+  }
+
+  FLUID_LOG(FLUID_DBG, "Audio thread finished");
+
+  pthread_exit(NULL);
+
+  return 0; /* not reached */
+}
+
+
+/*
+ * fluid_libsndio_audio_run
+ */
+void*
+fluid_libsndio_audio_run2(void* d)
+{
+  fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) d;
+  short* buffer = (short*) dev->buffer;
+  float* left = dev->buffers[0];
+  float* right = dev->buffers[1];
+  int buffer_size = dev->buffer_size;
+  int dither_index = 0;
+
+  FLUID_LOG(FLUID_DBG, "Audio thread running");
+
+  /* it's as simple as that: */
+  while (dev->cont)
+  {
+    (*dev->callback)(dev->data, buffer_size, 0, NULL, 2, dev->buffers);
+
+    fluid_synth_dither_s16 (&dither_index, buffer_size, left, right,
+                           buffer, 0, 2, buffer, 1, 2);
+
+    sio_write (dev->hdl, buffer, dev->buffer_byte_size);
+  }
+
+  FLUID_LOG(FLUID_DBG, "Audio thread finished");
+
+  pthread_exit(NULL);
+
+  return 0; /* not reached */
+}
+
+
+#endif /*#if LIBSNDIO_SUPPORT */
Index: patches/patch-acinclude_m4
===================================================================
RCS file: patches/patch-acinclude_m4
diff -N patches/patch-acinclude_m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-acinclude_m4  12 Dec 2008 12:28:03 -0000
@@ -0,0 +1,22 @@
+$OpenBSD$
+--- acinclude.m4.orig  Sat Oct 18 21:09:19 2008
++++ acinclude.m4       Sat Oct 18 21:11:47 2008
+@@ -43,13 +43,14 @@ AC_DEFUN([AC_OSS_AUDIO],
+   OSS_SUPPORT=0
+ 
+   if test "x$enable_oss_support" != "xno"; then
+-    AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h)
++    AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h 
soundcard.h)
+     if test "${ac_cv_header_fcntl_h}" = "yes" && \
+      test "${ac_cv_header_sys_ioctl_h}" = "yes"; then
+       if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
+-       test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
+-      OSS_SUPPORT=1
+-      AC_DEFINE(OSS_SUPPORT, 1, [Define to enable OSS driver])
++       test "${ac_cv_header_machine_soundcard_h}" = "yes" || \
++        test "${ac_cv_header_soundcard_h}" = "yes"; then
++       OSS_SUPPORT=1
++       AC_DEFINE(OSS_SUPPORT, 1, [Define to enable OSS driver])
+       else
+         AC_MSG_WARN([ *** Could not find soundcard.h, disabling OSS driver])
+       fi      dnl  soundcard.h header test
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- patches/patch-configure     6 Apr 2008 22:42:11 -0000       1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,68 +0,0 @@
-$OpenBSD: patch-configure,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
---- configure.orig     Sat Nov 17 13:32:16 2007
-+++ configure  Fri Feb 15 17:45:13 2008
-@@ -19986,13 +19986,13 @@ fi
- 
- 
- 
--{ echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
--echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
-+{ echo "$as_me:$LINENO: checking for pthread_create in -pthread" >&5
-+echo $ECHO_N "checking for pthread_create in -pthread... $ECHO_C" >&6; }
- if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
-   echo $ECHO_N "(cached) $ECHO_C" >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lpthread  $LIBS"
-+LIBS="-pthread  $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
- _ACEOF
-@@ -20052,7 +20052,7 @@ if test $ac_cv_lib_pthread_pthread_create = yes; then
- #define HAVE_LIBPTHREAD 1
- _ACEOF
- 
--  LIBS="-lpthread $LIBS"
-+  LIBS="-pthread $LIBS"
- 
- fi
- 
-@@ -20727,7 +20727,7 @@ esac
- 
- 
- 
-- if test "$mingw32_support" == "yes"; then
-+ if test "$mingw32_support" = "yes"; then
-   MINGW32_SUPPORT_TRUE=
-   MINGW32_SUPPORT_FALSE='#'
- else
-@@ -20899,7 +20899,7 @@ cat >>confdefs.h <<\_ACEOF
- _ACEOF
- 
- else
--  CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops 
-finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
-Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
-+  CFLAGS="${CFLAGS} ${FCCFLAGS} -Wall -W -Wpointer-arith -Wbad-function-cast 
-Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
- 
- cat >>confdefs.h <<\_ACEOF
- #define DEBUG 0
-@@ -21152,7 +21152,7 @@ fi
- 
- 
- 
--for ac_header in fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h
-+for ac_header in fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h 
soundcard.h
- do
- as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
- if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-@@ -21294,8 +21294,9 @@ done
-     if test "${ac_cv_header_fcntl_h}" = "yes" && \
-      test "${ac_cv_header_sys_ioctl_h}" = "yes"; then
-       if test "${ac_cv_header_sys_soundcard_h}" = "yes" || \
--       test "${ac_cv_header_machine_soundcard_h}" = "yes"; then
--      OSS_SUPPORT=1
-+       test "${ac_cv_header_machine_soundcard_h}" = "yes" || \
-+         test "${ac_cv_header_soundcard_h}" = "yes"; then
-+        OSS_SUPPORT=1
- 
- cat >>confdefs.h <<\_ACEOF
- #define OSS_SUPPORT 1
Index: patches/patch-configure_ac
===================================================================
RCS file: patches/patch-configure_ac
diff -N patches/patch-configure_ac
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure_ac  12 Dec 2008 12:28:03 -0000
@@ -0,0 +1,72 @@
+$OpenBSD$
+--- configure.ac.orig  Sat Oct 18 20:58:26 2008
++++ configure.ac       Sat Oct 18 21:08:50 2008
+@@ -49,7 +49,8 @@ AM_PROG_LIBTOOL
+ AC_PROG_MAKE_SET
+ 
+ dnl Check for libraries
+-AC_CHECK_LIB(pthread, pthread_create)
++dnl AC_CHECK_LIB(pthread, pthread_create)
++LIBS="$LIBS -pthread"
+ 
+ dnl Check for header files
+ AC_HEADER_STDC
+@@ -82,7 +83,7 @@ AC_SUBST(LIBFLUID_CPPFLAGS)
+ AC_SUBST(LIBFLUID_LDFLAGS)
+ AC_SUBST(FLUID_CPPFLAGS)
+ 
+-AM_CONDITIONAL(MINGW32_SUPPORT, test "$mingw32_support" == "yes")
++AM_CONDITIONAL(MINGW32_SUPPORT, test "$mingw32_support" = "yes")
+ 
+ AC_ARG_ENABLE(double, AS_HELP_STRING([--enable-double],
+       [double floating point for dsp (default=float)]),
+@@ -136,7 +137,7 @@ if test "$ENABLE_DEBUG" = "yes"; then
+   CFLAGS="${CFLAGS} ${FCCFLAGS} -g -Wall -W -Wpointer-arith 
-Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused"
+   AC_DEFINE(DEBUG, 1, [Define to activate debugging message]) 
+ else
+-  CFLAGS="${CFLAGS} ${FCCFLAGS} -O2 -fomit-frame-pointer -funroll-all-loops 
-finline-functions -Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
-Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
++  CFLAGS="${CFLAGS} ${FCCFLAGS} -Wall -W -Wpointer-arith -Wbad-function-cast 
-Wcast-qual -Wcast-align -Wstrict-prototypes -Wno-unused -Winline"
+   AC_DEFINE(DEBUG, 0, [Define to activate debugging message])
+ fi
+ 
+@@ -183,7 +184,27 @@ dnl - Check support for OSS audio
+ AC_OSS_AUDIO
+ AM_CONDITIONAL(OSS_SUPPORT, test "$OSS_SUPPORT" = "1")
+ 
++dnl - Check for libsndio support
++AC_ARG_ENABLE(libsndio-support, AS_HELP_STRING([--disable-libsndio-support],
++      [disable libsndio support (default=auto)]),
++  enable_libsndio=$enableval, enable_libsndio="yes")
+ 
++if test "x$enable_libsndio" != "xno"; then
++  AC_CHECK_HEADER(sndio.h, LIBSNDIO_SUPPORT=1, LIBSNDIO_SUPPORT=0)
++else
++  LIBSNDIO_SUPPORT=0
++fi
++
++if test "$LIBSNDIO_SUPPORT" = "1"; then
++  AC_DEFINE(LIBSNDIO_SUPPORT, 1, [Define to enable libsndio driver])
++fi
++AM_CONDITIONAL(LIBSNDIO_SUPPORT, test "$LIBSNDIO_SUPPORT" = "1")
++LIBSNDIO_CFLAGS=""
++AC_SUBST(LIBSNDIO_CFLAGS)
++LIBSNDIO_LIBS="-lsndio"
++AC_SUBST(LIBSNDIO_LIBS)
++
++
+ dnl - Check support for MidiShare
+ AC_MIDISHARE
+ 
+@@ -341,6 +362,12 @@ if test "${OSS_SUPPORT}" = "1"; then
+   echo "OSS:                   yes"
+ else 
+   echo "OSS:                   no"
++fi
++
++if test "${LIBSNDIO_SUPPORT}" = "1"; then
++  echo "libsndio:                 yes"
++else 
++  echo "libsndio:                 no"
+ fi
+ 
+ if test "${MIDISHARE_SUPPORT}" = "1"; then
Index: patches/patch-src_Makefile_am
===================================================================
RCS file: patches/patch-src_Makefile_am
diff -N patches/patch-src_Makefile_am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile_am       12 Dec 2008 12:28:03 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+--- src/Makefile.am.orig       Sun Nov 11 12:06:28 2007
++++ src/Makefile.am    Sat Oct 18 21:26:52 2008
+@@ -21,6 +21,10 @@ if OSS_SUPPORT
+ fluid_oss = fluid_oss.c
+ endif
+ 
++if LIBSNDIO_SUPPORT
++fluid_libsndio = fluid_libsndio.c
++endif
++
+ # if LASH_SUPPORT || LADCCA_SUPPORT (Makefile supports OR?)
+ if LASH_SUPPORT
+ fluid_lash = fluid_lash.c
+@@ -33,7 +37,7 @@ endif
+ 
+ # Extra files and optional drivers
+ EXTRA_DIST = fluid_dll.c fluid_dsound.c fluid_winmidi.c fluid_portaudio.c \
+-      fluid_coreaudio.c fluid_alsa.c fluid_oss.c \
++      fluid_coreaudio.c fluid_alsa.c fluid_oss.c fluid_libsndio.c \
+       fluid_dsp_simple.c \
+       fluid_sndmgr.c config_macos.h config_macosx.h config_macosx_pb.h \
+       config_win32.h fluid_jack.c
+@@ -47,6 +51,7 @@ libfluidsynth_la_SOURCES = \
+       $(fluid_jack) \
+       $(fluid_lash) \
+       $(fluid_oss) \
++      $(fluid_libsndio) \
+       $(fluid_windows) \
+       fluid_adriver.c \
+       fluid_adriver.h \
+@@ -108,7 +113,7 @@ INCLUDES = -I$(top_srcdir)/include $(LASH_CFLAGS) $(LA
+   $(READLINE_CFLAGS) $(JACK_CFLAGS) $(ALSA_CFLAGS)
+ 
+ libfluidsynth_la_LIBADD = $(LIBFLUID_LIBS) $(LASH_LIBS) $(LADCCA_LIBS) \
+-  $(READLINE_LIBS) $(COREAUDIO_LIBS) $(JACK_LIBS) $(ALSA_LIBS)
++  $(READLINE_LIBS) $(COREAUDIO_LIBS) $(JACK_LIBS) $(ALSA_LIBS) 
$(LIBSNDIO_LIBS) -lossaudio
+ libfluidsynth_la_LDFLAGS = \
+       -version-info @LT_VERSION_INFO@ \
+       -export-dynamic $(LIBFLUID_LDFLAGS)
Index: patches/patch-src_Makefile_in
===================================================================
RCS file: patches/patch-src_Makefile_in
diff -N patches/patch-src_Makefile_in
--- patches/patch-src_Makefile_in       6 Apr 2008 22:42:11 -0000       1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_Makefile_in,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
---- src/Makefile.in.orig       Fri Feb 15 17:43:01 2008
-+++ src/Makefile.in    Fri Feb 15 17:43:45 2008
-@@ -356,7 +356,7 @@ INCLUDES = -I$(top_srcdir)/include $(LASH_CFLAGS) $(LA
-   $(READLINE_CFLAGS) $(JACK_CFLAGS) $(ALSA_CFLAGS)
- 
- libfluidsynth_la_LIBADD = $(LIBFLUID_LIBS) $(LASH_LIBS) $(LADCCA_LIBS) \
--  $(READLINE_LIBS) $(COREAUDIO_LIBS) $(JACK_LIBS) $(ALSA_LIBS)
-+  $(READLINE_LIBS) $(COREAUDIO_LIBS) $(JACK_LIBS) $(ALSA_LIBS) -lossaudio
- 
- libfluidsynth_la_LDFLAGS = \
-       -version-info @LT_VERSION_INFO@ \
Index: patches/patch-src_config_h_in
===================================================================
RCS file: patches/patch-src_config_h_in
diff -N patches/patch-src_config_h_in
--- patches/patch-src_config_h_in       6 Apr 2008 22:42:11 -0000       1.1.1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,13 +0,0 @@
-$OpenBSD: patch-src_config_h_in,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
---- src/config.h.in.orig       Fri Feb 15 17:22:28 2008
-+++ src/config.h.in    Fri Feb 15 17:23:02 2008
-@@ -72,6 +72,9 @@
- /* Define to 1 if you have the <signal.h> header file. */
- #undef HAVE_SIGNAL_H
- 
-+/* Define to 1 if you have the <soundcard.h> header file. */
-+#undef HAVE_SOUNDCARD_H
-+
- /* Define to 1 if you have the <stdarg.h> header file. */
- #undef HAVE_STDARG_H
- 
Index: patches/patch-src_fluid_adriver_c
===================================================================
RCS file: patches/patch-src_fluid_adriver_c
diff -N patches/patch-src_fluid_adriver_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_fluid_adriver_c   12 Dec 2008 12:28:03 -0000
@@ -0,0 +1,52 @@
+$OpenBSD$
+--- src/fluid_adriver.c.orig   Sat Oct 18 20:34:27 2008
++++ src/fluid_adriver.c        Sat Oct 18 20:36:59 2008
+@@ -56,6 +56,15 @@ int delete_fluid_oss_audio_driver(fluid_audio_driver_t
+ void fluid_oss_audio_driver_settings(fluid_settings_t* settings);
+ #endif
+ 
++#if LIBSNDIO_SUPPORT
++fluid_audio_driver_t* new_fluid_libsndio_audio_driver(fluid_settings_t* 
settings,
++                                               fluid_synth_t* synth);
++fluid_audio_driver_t* new_fluid_libsndio_audio_driver2(fluid_settings_t* 
settings,
++                                              fluid_audio_func_t func, void* 
data);
++int delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p);
++void fluid_libsndio_audio_driver_settings(fluid_settings_t* settings);
++#endif
++
+ #if COREAUDIO_SUPPORT
+ fluid_audio_driver_t* new_fluid_core_audio_driver(fluid_settings_t* settings,
+                                                 fluid_synth_t* synth);
+@@ -112,6 +121,13 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
+     delete_fluid_oss_audio_driver,
+     fluid_oss_audio_driver_settings },
+ #endif
++#if LIBSNDIO_SUPPORT
++  { "libsndio",
++    new_fluid_libsndio_audio_driver,
++    new_fluid_libsndio_audio_driver2,
++    delete_fluid_libsndio_audio_driver,
++    fluid_libsndio_audio_driver_settings },
++#endif
+ #if ALSA_SUPPORT
+   { "alsa",
+     new_fluid_alsa_audio_driver,
+@@ -193,6 +209,8 @@ void fluid_audio_driver_settings(fluid_settings_t* set
+   /* Set the default driver */
+ #if ALSA_SUPPORT
+   fluid_settings_register_str(settings, "audio.driver", "alsa", 0, NULL, 
NULL);
++#elif LIBSNDIO_SUPPORT
++  fluid_settings_register_str(settings, "audio.driver", "libsndio", 0, NULL, 
NULL);
+ #elif OSS_SUPPORT
+   fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL);
+ #elif COREAUDIO_SUPPORT
+@@ -217,6 +235,9 @@ void fluid_audio_driver_settings(fluid_settings_t* set
+ #endif
+ #if OSS_SUPPORT
+   fluid_settings_add_option(settings, "audio.driver", "oss");
++#endif
++#if LIBSNDIO_SUPPORT
++  fluid_settings_add_option(settings, "audio.driver", "libsndio");
+ #endif
+ #if COREAUDIO_SUPPORT
+   fluid_settings_add_option(settings, "audio.driver", "coreaudio");
Index: pkg/PLIST
===================================================================
RCS file: /home2/cvs/OpenBSD/ports/audio/fluidsynth/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 PLIST
--- pkg/PLIST   6 Apr 2008 22:42:11 -0000       1.1.1.1
+++ pkg/PLIST   12 Dec 2008 12:28:03 -0000
@@ -1,6 +1,6 @@
 @comment $OpenBSD: PLIST,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
 %%SHARED%%
-bin/fluidsynth
+...@bin bin/fluidsynth
 include/fluidsynth/
 include/fluidsynth.h
 include/fluidsynth/audio.h

Reply via email to