- add sndio backend

- drop OSS audio support but keep "OSS" midi support
This commit is contained in:
jakemsr 2008-12-26 08:45:12 +00:00
parent 3b54db1308
commit a6e78cfa88
12 changed files with 638 additions and 240 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
# $OpenBSD: Makefile,v 1.3 2008/12/26 08:45:12 jakemsr Exp $
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_PACKAGE_FTP = Yes
PERMIT_DISTFILES_CDROM = Yes
PERMIT_DISTFILES_FTP = Yes
WANTLIB = c m ncurses ossaudio pthread readline
WANTLIB = c m ncurses pthread readline samplerate sndio
MASTER_SITES = http://download.savannah.gnu.org/releases/fluid/
@ -27,10 +27,24 @@ MAKE_FLAGS = CFLAGS="${CFLAGS} ${DEV_FLAGS}"
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
--disable-ladcca \
--disable-oss-support
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>

View File

@ -0,0 +1,372 @@
/* libsndio backend for FluidSynth - A Software Synthesizer
*
* Copyright (c) 2008 Jacob Meuser <jakemsr@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.appbufsz = 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.appbufsz = 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 */

View File

@ -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

View File

@ -0,0 +1,72 @@
$OpenBSD: patch-configure_ac,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
--- 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

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-fluidsynth_pc_in,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
--- fluidsynth.pc.in.orig Fri Feb 15 20:11:52 2008
+++ fluidsynth.pc.in Fri Feb 15 20:12:46 2008
$OpenBSD: patch-fluidsynth_pc_in,v 1.2 2008/12/26 08:45:12 jakemsr Exp $
--- fluidsynth.pc.in.orig Sat Aug 18 14:55:32 2007
+++ fluidsynth.pc.in Sat Dec 20 17:33:14 2008
@@ -6,5 +6,5 @@ includedir=@includedir@
Name: FluidSynth
Description: Software SoundFont synth
Version: @VERSION@
-Libs: -L${libdir} -lfluidsynth
+Libs: -L${libdir} -lfluidsynth @READLINE_LIBS@ @LIBFLUID_LIBS@ @LIBS@ -lossaudio
+Libs: -L${libdir} -lfluidsynth @READLINE_LIBS@ @LIBFLUID_LIBS@ @LIBS@
Cflags: -I${includedir}

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-src_Makefile_am,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
--- src/Makefile.am.orig Sun Nov 11 12:06:28 2007
+++ src/Makefile.am Sat Dec 20 17:37:23 2008
@@ -17,8 +17,12 @@ if MINGW32_SUPPORT
fluid_windows = fluid_dll.c fluid_dsound.c fluid_winmidi.c
endif
-if OSS_SUPPORT
+# 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?)
@@ -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)
libfluidsynth_la_LDFLAGS = \
-version-info @LT_VERSION_INFO@ \
-export-dynamic $(LIBFLUID_LDFLAGS)

View File

@ -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@ \

View File

@ -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

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-src_fluid_adriver_c,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
--- 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");

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-src_fluid_mdriver_c,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
--- src/fluid_mdriver.c.orig Sat Dec 20 17:42:12 2008
+++ src/fluid_mdriver.c Sat Dec 20 17:43:01 2008
@@ -38,13 +38,13 @@ void fluid_alsa_seq_driver_settings(fluid_settings_t*
#endif
/* OSS */
-#if OSS_SUPPORT
+/* #if OSS_SUPPORT */
fluid_midi_driver_t* new_fluid_oss_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
int delete_fluid_oss_midi_driver(fluid_midi_driver_t* p);
void fluid_oss_midi_driver_settings(fluid_settings_t* settings);
-#endif
+/* #endif */
/* Windows MIDI service */
#if WINMIDI_SUPPORT
@@ -78,12 +78,12 @@ struct fluid_mdriver_definition_t {
struct fluid_mdriver_definition_t fluid_midi_drivers[] = {
-#if OSS_SUPPORT
+/* #if OSS_SUPPORT */
{ "oss",
new_fluid_oss_midi_driver,
delete_fluid_oss_midi_driver,
fluid_oss_midi_driver_settings },
-#endif
+/* #endif */
#if ALSA_SUPPORT
{ "alsa_raw",
new_fluid_alsa_rawmidi_driver,

View File

@ -1,147 +1,46 @@
$OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
$OpenBSD: patch-src_fluid_oss_c,v 1.3 2008/12/26 08:45:12 jakemsr Exp $
--- src/fluid_oss.c.orig Tue Sep 18 23:10:57 2007
+++ src/fluid_oss.c Sun Apr 20 03:40:45 2008
@@ -32,8 +32,13 @@
+++ src/fluid_oss.c Sat Dec 20 17:57:57 2008
@@ -34,6 +34,9 @@
#if OSS_SUPPORT
+#ifdef HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
+#endif
#include <sys/ioctl.h>
+#ifdef HAVE_SOUNDCARD_H
+#include <soundcard.h>
+#endif
+
+#endif /*#if OSS_SUPPORT */
+
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -103,7 +108,7 @@ static void* fluid_oss_midi_run(void* d);
@@ -49,6 +52,8 @@
#define OSS_PCM_SCHED_PRIORITY 90
#define OSS_MIDI_SCHED_PRIORITY 90
+#if OSS_SUPPORT
+
/** fluid_oss_audio_driver_t
*
* This structure should not be accessed directly. Use audio port
@@ -82,6 +87,7 @@ static int fluid_oss_get_sample_formats(fluid_oss_audi
static void* fluid_oss_audio_run(void* d);
static void* fluid_oss_audio_run2(void* d);
+#endif /*#if OSS_SUPPORT */
typedef struct {
fluid_midi_driver_t driver;
@@ -99,6 +105,7 @@ int delete_fluid_oss_midi_driver(fluid_midi_driver_t*
int fluid_oss_midi_driver_status(fluid_midi_driver_t* p);
static void* fluid_oss_midi_run(void* d);
+#if OSS_SUPPORT
void
fluid_oss_audio_driver_settings(fluid_settings_t* settings)
{
- fluid_settings_register_str(settings, "audio.oss.device", "/dev/dsp", 0, NULL, NULL);
+ fluid_settings_register_str(settings, "audio.oss.device", DEVOSSAUDIO, 0, NULL, NULL);
@@ -639,10 +646,11 @@ fluid_oss_audio_run2(void* d)
return 0; /* not reached */
}
/*
@@ -122,8 +127,10 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
int format;
pthread_attr_t attr;
int err;
+#if !defined(__OpenBSD__)
int sched = SCHED_FIFO;
struct sched_param priority;
+#endif
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if (dev == NULL) {
@@ -146,7 +153,11 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
if (fluid_settings_str_equal(settings, "audio.sample-format", "16bits")) {
sample_size = 16;
+#ifdef WORDS_BIGENDIAN
+ oss_format = AFMT_S16_BE;
+#else
oss_format = AFMT_S16_LE;
+#endif
dev->read = fluid_synth_write_s16;
dev->buffer_byte_size = dev->buffer_size * 4;
@@ -168,7 +179,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
}
if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
- devname = "/dev/dsp";
+ devname = DEVOSSAUDIO;
}
if (stat(devname, &devstat) == -1) {
@@ -229,6 +240,13 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
goto error_recovery;
}
+#if defined(__OpenBSD__)
+ err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run, (void*) dev);
+ if (err) {
+ FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
+ goto error_recovery;
+ }
+#else
/* the pthread_create man page explains that
pthread_attr_setschedpolicy returns an error if the user is not
permitted the set SCHED_FIFO. it seems however that no error is
@@ -264,6 +282,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
}
break;
}
+#endif /* __OpenBSD__ */
return (fluid_audio_driver_t*) dev;
@@ -285,8 +304,10 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
int format;
pthread_attr_t attr;
int err;
+#if !defined(__OpenBSD__)
int sched = SCHED_FIFO;
struct sched_param priority;
+#endif
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if (dev == NULL) {
@@ -311,7 +332,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
- devname = "/dev/dsp";
+ devname = DEVOSSAUDIO;
}
if (stat(devname, &devstat) == -1) {
FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);
@@ -335,12 +356,20 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
goto error_recovery;
}
+#ifdef WORDS_BIGENDIAN
+ format = AFMT_S16_BE;
+#else
format = AFMT_S16_LE;
+#endif
if (ioctl(dev->dspfd, SNDCTL_DSP_SETFMT, &format) < 0) {
FLUID_LOG(FLUID_ERR, "Can't set the sample format");
goto error_recovery;
}
+#ifdef WORDS_BIGENDIAN
+ if (format != AFMT_S16_BE) {
+#else
if (format != AFMT_S16_LE) {
+#endif
FLUID_LOG(FLUID_ERR, "Can't set the sample format");
goto error_recovery;
}
@@ -380,6 +409,13 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
goto error_recovery;
}
+#if defined(__OpenBSD__)
+ err = pthread_create(&dev->thread, &attr, fluid_oss_audio_run2, (void*) dev);
+ if (err) {
+ FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
+ goto error_recovery;
+ }
+#else
/* the pthread_create man page explains that
pthread_attr_setschedpolicy returns an error if the user is not
permitted the set SCHED_FIFO. it seems however that no error is
@@ -415,6 +451,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
}
break;
}
+#endif /* __OpenBSD__ */
return (fluid_audio_driver_t*) dev;
@@ -642,7 +679,7 @@ fluid_oss_audio_run2(void* d)
+#endif /*#if OSS_SUPPORT */
void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
{
@ -150,7 +49,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
}
/*
@@ -655,8 +692,10 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -655,8 +663,10 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
int err;
fluid_oss_midi_driver_t* dev;
pthread_attr_t attr;
@ -161,7 +60,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
char* device;
/* not much use doing anything */
@@ -687,7 +726,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -687,7 +697,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
/* get the device name. if none is specified, use the default device. */
fluid_settings_getstr(settings, "midi.oss.device", &device);
if (device == NULL) {
@ -170,7 +69,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
}
/* open the default hardware device. only use midi in. */
@@ -704,6 +743,14 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -704,6 +714,14 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
FLUID_LOG(FLUID_ERR, "Couldn't initialize midi thread attributes");
goto error_recovery;
}
@ -185,7 +84,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
/* use fifo scheduling. if it fails, use default scheduling. */
while (1) {
err = pthread_attr_setschedpolicy(&attr, sched);
@@ -735,6 +782,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -735,6 +753,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
}
break;
}
@ -193,3 +92,8 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
return (fluid_midi_driver_t*) dev;
error_recovery:
@@ -833,4 +852,3 @@ fluid_oss_midi_driver_status(fluid_midi_driver_t* p)
return dev->status;
}
-#endif /*#if OSS_SUPPORT */

View File

@ -1,6 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
@comment $OpenBSD: PLIST,v 1.2 2008/12/26 08:45:12 jakemsr Exp $
%%SHARED%%
bin/fluidsynth
@bin bin/fluidsynth
include/fluidsynth/
include/fluidsynth.h
include/fluidsynth/audio.h