- update to 1.0.9

- inlude sndio(7) midi support from ratchov@
- 'libsndio' -> 'sndio' renaming throughout
- completely disable OSS support
This commit is contained in:
jakemsr 2009-10-15 15:44:50 +00:00
parent 9f4650538c
commit a62a108b80
12 changed files with 357 additions and 289 deletions

View File

@ -1,10 +1,9 @@
# $OpenBSD: Makefile,v 1.5 2009/03/06 21:24:52 jasper Exp $
# $OpenBSD: Makefile,v 1.6 2009/10/15 15:44:50 jakemsr Exp $
COMMENT = SoundFont2 software synthesizer
DISTNAME = fluidsynth-1.0.8
PKGNAME = ${DISTNAME}p2
DISTNAME = fluidsynth-1.0.9
SHARED_LIBS = fluidsynth 0.0
SHARED_LIBS = fluidsynth 0.1
CATEGORIES = audio
HOMEPAGE = http://fluidsynth.resonance.org/trac
@ -21,10 +20,6 @@ WANTLIB = c m ncurses pthread readline sndio
MASTER_SITES = ${MASTER_SITE_SAVANNAH:=fluid/}
DEV_FLAGS = -DDEVOSSAUDIO=\\\"/dev/audio\\\" \
-DDEVOSSMIDI=\\\"/dev/rmidi0\\\"
MAKE_FLAGS = CFLAGS="${CFLAGS} ${DEV_FLAGS}"
LIB_DEPENDS = jack::audio/jack
AUTOCONF_VERSION = 2.61
@ -38,10 +33,11 @@ CONFIGURE_STYLE = gnu
CONFIGURE_ARGS += ${CONFIGURE_SHARED} \
--disable-lash \
--disable-ladcca \
--disable-oss-support
--disable-oss-support \
--disable-portaudio-support
post-patch:
cp ${FILESDIR}/fluid_libsndio.c ${WRKSRC}/src/
cp ${FILESDIR}/fluid_sndio.c ${WRKSRC}/src/
pre-configure:
cd ${WRKSRC} && AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \

View File

@ -1,5 +1,5 @@
MD5 (fluidsynth-1.0.8.tar.gz) = 4qv9Lmn9iyjZZd+WjX1E7g==
RMD160 (fluidsynth-1.0.8.tar.gz) = H2R2Je2JN/SAQBg287b3gZ+kark=
SHA1 (fluidsynth-1.0.8.tar.gz) = H1/ZlkpyEvdykFckSXq9RqseJTY=
SHA256 (fluidsynth-1.0.8.tar.gz) = RefJln0PsDRPTaU5qzQ/uXk4SzakKahZTJTPRm3/QyA=
SIZE (fluidsynth-1.0.8.tar.gz) = 1267922
MD5 (fluidsynth-1.0.9.tar.gz) = WEdVLglSj8kdyojxDLk5HA==
RMD160 (fluidsynth-1.0.9.tar.gz) = B37LEwAO5Y68DPzeZTI6ehEo8eI=
SHA1 (fluidsynth-1.0.9.tar.gz) = /tjc2KgWmB4eMKyIGKRZSetPWcA=
SHA256 (fluidsynth-1.0.9.tar.gz) = Fxtrt1T7Y0LNAPkTn1hzvBt2TUos/nBAmq5ssfAabmA=
SIZE (fluidsynth-1.0.9.tar.gz) = 927002

View File

@ -1,4 +1,4 @@
/* libsndio backend for FluidSynth - A Software Synthesizer
/* sndio backend for FluidSynth - A Software Synthesizer
*
* Copyright (c) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
*
@ -16,16 +16,18 @@
*/
/* fluid_libsndio.c
/* fluid_sndio.c
*
* Driver for the libsndio audio access library
* Driver for the sndio audio access library
*/
#include "fluid_synth.h"
#include "fluid_adriver.h"
#include "fluid_midi.h"
#include "fluid_mdriver.h"
#include "fluid_settings.h"
#if LIBSNDIO_SUPPORT
#if SNDIO_SUPPORT
#include <sndio.h>
@ -35,7 +37,7 @@
#include <unistd.h>
/** fluid_libsndio_audio_driver_t
/** fluid_sndio_audio_driver_t
*
* This structure should not be accessed directly. Use audio port
* functions instead.
@ -54,28 +56,36 @@ typedef struct {
fluid_audio_func_t callback;
void* data;
float* buffers[2];
} fluid_libsndio_audio_driver_t;
} fluid_sndio_audio_driver_t;
int delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p);
typedef struct {
fluid_midi_driver_t driver;
struct mio_hdl *hdl;
pthread_t thread;
int status;
fluid_midi_parser_t *parser;
} fluid_sndio_midi_driver_t;
int delete_fluid_sndio_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);
static void* fluid_sndio_audio_run(void* d);
static void* fluid_sndio_audio_run2(void* d);
void
fluid_libsndio_audio_driver_settings(fluid_settings_t* settings)
fluid_sndio_audio_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "audio.libsndio.device", NULL, 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.sndio.device", NULL, 0, NULL, NULL);
}
/*
* new_fluid_libsndio_audio_driver
* new_fluid_sndio_audio_driver
*/
fluid_audio_driver_t*
new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
new_fluid_sndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
{
fluid_libsndio_audio_driver_t* dev = NULL;
fluid_sndio_audio_driver_t* dev = NULL;
int queuesize;
double sample_rate;
int periods, period_size;
@ -83,12 +93,12 @@ new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth
pthread_attr_t attr;
int err;
dev = FLUID_NEW(fluid_libsndio_audio_driver_t);
dev = FLUID_NEW(fluid_sndio_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_MEMSET(dev, 0, sizeof(fluid_sndio_audio_driver_t));
fluid_settings_getint(settings, "audio.periods", &periods);
fluid_settings_getint(settings, "audio.period-size", &period_size);
@ -102,13 +112,13 @@ new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth
dev->buffer_size = (int) period_size;
queuesize = (int) (periods * period_size);
if (!fluid_settings_getstr(settings, "audio.libsndio.device", &devname)) {
if (!fluid_settings_getstr(settings, "audio.sndio.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");
FLUID_LOG(FLUID_ERR, "sndio could not be opened for writing");
goto error_recovery;
}
@ -142,21 +152,21 @@ new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth
dev->par.rate = sample_rate;
if (!sio_setpar(dev->hdl, &dev->par)) {
FLUID_LOG(FLUID_ERR, "Couldn't set libsndio audio parameters");
FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters");
goto error_recovery;
}
if (!sio_getpar(dev->hdl, &dev->par)) {
FLUID_LOG(FLUID_ERR, "Couldn't get libsndio audio parameters");
FLUID_LOG(FLUID_ERR, "Couldn't get sndio 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");
FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters as desired");
goto error_recovery;
}
if (!sio_start(dev->hdl)) {
FLUID_LOG(FLUID_ERR, "Couldn't start libsndio");
FLUID_LOG(FLUID_ERR, "Couldn't start sndio");
goto error_recovery;
}
@ -165,7 +175,7 @@ new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth
goto error_recovery;
}
err = pthread_create(&dev->thread, &attr, fluid_libsndio_audio_run, (void*) dev);
err = pthread_create(&dev->thread, &attr, fluid_sndio_audio_run, (void*) dev);
if (err) {
FLUID_LOG(FLUID_ERR, "Couldn't create audio thread");
goto error_recovery;
@ -174,14 +184,14 @@ new_fluid_libsndio_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth
return (fluid_audio_driver_t*) dev;
error_recovery:
delete_fluid_libsndio_audio_driver((fluid_audio_driver_t*) dev);
delete_fluid_sndio_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)
new_fluid_sndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func, void* data)
{
fluid_libsndio_audio_driver_t* dev = NULL;
fluid_sndio_audio_driver_t* dev = NULL;
int queuesize;
double sample_rate;
int periods, period_size;
@ -189,12 +199,12 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
pthread_attr_t attr;
int err;
dev = FLUID_NEW(fluid_libsndio_audio_driver_t);
dev = FLUID_NEW(fluid_sndio_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_MEMSET(dev, 0, sizeof(fluid_sndio_audio_driver_t));
fluid_settings_getint(settings, "audio.periods", &periods);
fluid_settings_getint(settings, "audio.period-size", &period_size);
@ -210,13 +220,13 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
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)) {
if (!fluid_settings_getstr(settings, "audio.sndio.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");
FLUID_LOG(FLUID_ERR, "sndio could not be opened for writing");
goto error_recovery;
}
@ -236,16 +246,16 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
dev->par.rate = sample_rate;
if (!sio_setpar(dev->hdl, &dev->par)){
FLUID_LOG(FLUID_ERR, "Can't configure libsndio parameters");
FLUID_LOG(FLUID_ERR, "Can't configure sndio parameters");
goto error_recovery;
}
if (!sio_getpar(dev->hdl, &dev->par)) {
FLUID_LOG(FLUID_ERR, "Couldn't get libsndio audio parameters");
FLUID_LOG(FLUID_ERR, "Couldn't get sndio 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");
FLUID_LOG(FLUID_ERR, "Couldn't set sndio audio parameters as desired");
goto error_recovery;
}
@ -259,7 +269,7 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
}
if (!sio_start(dev->hdl)) {
FLUID_LOG(FLUID_ERR, "Couldn't start libsndio");
FLUID_LOG(FLUID_ERR, "Couldn't start sndio");
goto error_recovery;
}
@ -268,7 +278,7 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
goto error_recovery;
}
err = pthread_create(&dev->thread, &attr, fluid_libsndio_audio_run2, (void*) dev);
err = pthread_create(&dev->thread, &attr, fluid_sndio_audio_run2, (void*) dev);
if (err) {
FLUID_LOG(FLUID_ERR, "Couldn't create audio2 thread");
goto error_recovery;
@ -277,17 +287,17 @@ new_fluid_libsndio_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t
return (fluid_audio_driver_t*) dev;
error_recovery:
delete_fluid_libsndio_audio_driver((fluid_audio_driver_t*) dev);
delete_fluid_sndio_audio_driver((fluid_audio_driver_t*) dev);
return NULL;
}
/*
* delete_fluid_libsndio_audio_driver
* delete_fluid_sndio_audio_driver
*/
int
delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p)
delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p)
{
fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) p;
fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) p;
if (dev == NULL) {
return FLUID_OK;
@ -310,12 +320,12 @@ delete_fluid_libsndio_audio_driver(fluid_audio_driver_t* p)
}
/*
* fluid_libsndio_audio_run
* fluid_sndio_audio_run
*/
void*
fluid_libsndio_audio_run(void* d)
fluid_sndio_audio_run(void* d)
{
fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) d;
fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) d;
fluid_synth_t* synth = dev->synth;
void* buffer = dev->buffer;
int len = dev->buffer_size;
@ -336,12 +346,12 @@ fluid_libsndio_audio_run(void* d)
/*
* fluid_libsndio_audio_run
* fluid_sndio_audio_run
*/
void*
fluid_libsndio_audio_run2(void* d)
fluid_sndio_audio_run2(void* d)
{
fluid_libsndio_audio_driver_t* dev = (fluid_libsndio_audio_driver_t*) d;
fluid_sndio_audio_driver_t* dev = (fluid_sndio_audio_driver_t*) d;
short* buffer = (short*) dev->buffer;
float* left = dev->buffers[0];
float* right = dev->buffers[1];
@ -368,5 +378,153 @@ fluid_libsndio_audio_run2(void* d)
return 0; /* not reached */
}
void fluid_sndio_midi_driver_settings(fluid_settings_t* settings)
{
fluid_settings_register_str(settings, "midi.sndio.device", NULL, 0, NULL, NULL);
}
#endif /*#if LIBSNDIO_SUPPORT */
int
delete_fluid_sndio_midi_driver(fluid_midi_driver_t *addr)
{
int err;
fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
if (dev == NULL) {
return FLUID_OK;
}
dev->status = FLUID_MIDI_DONE;
/* cancel the thread and wait for it before cleaning up */
if (dev->thread) {
err = pthread_cancel(dev->thread);
if (err) {
FLUID_LOG(FLUID_ERR, "Failed to cancel the midi thread");
return FLUID_FAILED;
}
if (pthread_join(dev->thread, NULL)) {
FLUID_LOG(FLUID_ERR, "Failed to join the midi thread");
return FLUID_FAILED;
}
}
if (dev->hdl != NULL) {
mio_close(dev->hdl);
}
if (dev->parser != NULL) {
delete_fluid_midi_parser(dev->parser);
}
FLUID_FREE(dev);
return FLUID_OK;
}
void *
fluid_sndio_midi_run(void *addr)
{
int n, i;
fluid_midi_event_t* evt;
fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
#define MIDI_BUFLEN (3125 / 10)
unsigned char buffer[MIDI_BUFLEN];
/* make sure the other threads can cancel this thread any time */
if (pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)) {
FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
pthread_exit(NULL);
}
if (pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL)) {
FLUID_LOG(FLUID_ERR, "Failed to set the cancel state of the midi thread");
pthread_exit(NULL);
}
/* go into a loop until someone tells us to stop */
dev->status = FLUID_MIDI_LISTENING;
while (dev->status == FLUID_MIDI_LISTENING) {
/* read new data */
n = mio_read(dev->hdl, buffer, MIDI_BUFLEN);
if (n == 0 && mio_eof(dev->hdl)) {
fprintf(stderr, "cant read midi device\n");
FLUID_LOG(FLUID_ERR, "Failed to read the midi input");
dev->status = FLUID_MIDI_DONE;
}
/* let the parser convert the data into events */
for (i = 0; i < n; i++) {
evt = fluid_midi_parser_parse(dev->parser, buffer[i]);
if (evt != NULL) {
/* send the event to the next link in the chain */
(*dev->driver.handler)(dev->driver.data, evt);
}
}
}
pthread_exit(NULL);
}
int
fluid_sndio_midi_driver_status(fluid_midi_driver_t *addr)
{
fluid_sndio_midi_driver_t *dev = (fluid_sndio_midi_driver_t *)addr;
return dev->status;
}
fluid_midi_driver_t *
new_fluid_sndio_midi_driver(fluid_settings_t *settings,
handle_midi_event_func_t handler, void *data)
{
int err;
fluid_sndio_midi_driver_t *dev;
char *device;
/* not much use doing anything */
if (handler == NULL) {
FLUID_LOG(FLUID_ERR, "Invalid argument");
return NULL;
}
/* allocate the device */
dev = FLUID_NEW(fluid_sndio_midi_driver_t);
if (dev == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
FLUID_MEMSET(dev, 0, sizeof(fluid_sndio_midi_driver_t));
dev->hdl = NULL;
dev->driver.handler = handler;
dev->driver.data = data;
/* allocate one event to store the input data */
dev->parser = new_fluid_midi_parser();
if (dev->parser == NULL) {
FLUID_LOG(FLUID_ERR, "Out of memory");
goto error_recovery;
}
/* get the device name. if none is specified, use the default device. */
if (!fluid_settings_getstr(settings, "midi.sndio.device", &device)) {
device = NULL;
}
/* open the default hardware device. only use midi in. */
dev->hdl = mio_open(device, MIO_IN, 0);
if (dev->hdl == NULL) {
fprintf(stderr, "%s: couldn't open midi device\n");
goto error_recovery;
}
dev->status = FLUID_MIDI_READY;
err = pthread_create(&dev->thread, NULL, fluid_sndio_midi_run, (void *)dev);
if (err) {
FLUID_LOG(FLUID_PANIC, "Couldn't create the midi thread.");
goto error_recovery;
}
return (fluid_midi_driver_t *) dev;
error_recovery:
delete_fluid_sndio_midi_driver((fluid_midi_driver_t *)dev);
return NULL;
}
#endif /*#if SNDIO_SUPPORT */

View File

@ -1,7 +1,7 @@
$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
$OpenBSD: patch-configure_ac,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- configure.ac.orig Sat Apr 11 22:06:55 2009
+++ configure.ac Tue Oct 13 20:59:08 2009
@@ -50,7 +50,8 @@ AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
dnl Check for libraries
@ -11,7 +11,7 @@ $OpenBSD: patch-configure_ac,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
dnl Check for header files
AC_HEADER_STDC
@@ -82,7 +83,7 @@ AC_SUBST(LIBFLUID_CPPFLAGS)
@@ -87,7 +88,7 @@ AC_SUBST(LIBFLUID_CPPFLAGS)
AC_SUBST(LIBFLUID_LDFLAGS)
AC_SUBST(FLUID_CPPFLAGS)
@ -20,7 +20,7 @@ $OpenBSD: patch-configure_ac,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
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
@@ -141,7 +142,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
@ -29,44 +29,44 @@ $OpenBSD: patch-configure_ac,v 1.1 2008/12/26 08:45:12 jakemsr Exp $
AC_DEFINE(DEBUG, 0, [Define to activate debugging message])
fi
@@ -183,7 +184,27 @@ dnl - Check support for OSS audio
@@ -228,7 +229,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")
+dnl - Check for sndio support
+AC_ARG_ENABLE(sndio-support, AS_HELP_STRING([--disable-sndio-support],
+ [disable sndio support (default=auto)]),
+ enable_sndio=$enableval, enable_sndio="yes")
+if test "x$enable_libsndio" != "xno"; then
+ AC_CHECK_HEADER(sndio.h, LIBSNDIO_SUPPORT=1, LIBSNDIO_SUPPORT=0)
+if test "x$enable_sndio" != "xno"; then
+ AC_CHECK_HEADER(sndio.h, SNDIO_SUPPORT=1, SNDIO_SUPPORT=0)
+else
+ LIBSNDIO_SUPPORT=0
+ SNDIO_SUPPORT=0
+fi
+
+if test "$LIBSNDIO_SUPPORT" = "1"; then
+ AC_DEFINE(LIBSNDIO_SUPPORT, 1, [Define to enable libsndio driver])
+if test "$SNDIO_SUPPORT" = "1"; then
+ AC_DEFINE(SNDIO_SUPPORT, 1, [Define to enable sndio driver])
+fi
+AM_CONDITIONAL(LIBSNDIO_SUPPORT, test "$LIBSNDIO_SUPPORT" = "1")
+LIBSNDIO_CFLAGS=""
+AC_SUBST(LIBSNDIO_CFLAGS)
+LIBSNDIO_LIBS="-lsndio"
+AC_SUBST(LIBSNDIO_LIBS)
+AM_CONDITIONAL(SNDIO_SUPPORT, test "$SNDIO_SUPPORT" = "1")
+SNDIO_CFLAGS=""
+AC_SUBST(SNDIO_CFLAGS)
+SNDIO_LIBS="-lsndio"
+AC_SUBST(SNDIO_LIBS)
+
+
dnl - Check support for MidiShare
AC_MIDISHARE
@@ -341,6 +362,12 @@ if test "${OSS_SUPPORT}" = "1"; then
@@ -440,6 +461,12 @@ if test "${OSS_SUPPORT}" = "1"; then
echo "OSS: yes"
else
echo "OSS: no"
+fi
+
+if test "${LIBSNDIO_SUPPORT}" = "1"; then
+ echo "libsndio: yes"
+if test "${SNDIO_SUPPORT}" = "1"; then
+ echo "sndio: yes"
+else
+ echo "libsndio: no"
+ echo "sndio: no"
fi
if test "${MIDISHARE_SUPPORT}" = "1"; then

View File

@ -1,43 +1,40 @@
$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
$OpenBSD: patch-src_Makefile_am,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/Makefile.am.orig Tue Feb 3 23:34:02 2009
+++ src/Makefile.am Tue Oct 13 21:12:04 2009
@@ -33,6 +33,10 @@ if OSS_SUPPORT
fluid_oss = fluid_oss.c
+# endif
+
+if LIBSNDIO_SUPPORT
+fluid_libsndio = fluid_libsndio.c
endif
+if SNDIO_SUPPORT
+fluid_sndio = fluid_sndio.c
+endif
+
# if LASH_SUPPORT || LADCCA_SUPPORT (Makefile supports OR?)
@@ -33,7 +37,7 @@ endif
if LASH_SUPPORT
fluid_lash = fluid_lash.c
@@ -49,7 +53,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_coreaudio.c fluid_alsa.c fluid_oss.c fluid_pulse.c \
- fluid_dsp_simple.c \
+ fluid_sndio.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) \
config_win32.h fluid_jack.c fluid_dart.c
@@ -65,6 +69,7 @@ libfluidsynth_la_SOURCES = \
$(fluid_oss) \
+ $(fluid_libsndio) \
$(fluid_portaudio) \
$(fluid_pulse) \
+ $(fluid_sndio) \
$(fluid_windows) \
$(fluid_dart) \
fluid_adriver.c \
fluid_adriver.h \
@@ -108,7 +113,7 @@ INCLUDES = -I$(top_srcdir)/include $(LASH_CFLAGS) $(LA
$(READLINE_CFLAGS) $(JACK_CFLAGS) $(ALSA_CFLAGS)
@@ -129,7 +134,7 @@ INCLUDES = -I$(top_srcdir)/include $(LASH_CFLAGS) $(LA
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)
$(READLINE_LIBS) $(COREAUDIO_LIBS) $(COREMIDI_LIBS) $(JACK_LIBS) \
- $(ALSA_LIBS) $(PULSE_LIBS) $(PORTAUDIO_LIBS) $(DART_LIBS)
+ $(ALSA_LIBS) $(PULSE_LIBS) $(PORTAUDIO_LIBS) $(DART_LIBS) $(SNDIO_LIBS)
libfluidsynth_la_LDFLAGS = \
-version-info @LT_VERSION_INFO@ \
-export-dynamic $(LIBFLUID_LDFLAGS)

View File

@ -1,52 +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
$OpenBSD: patch-src_fluid_adriver_c,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/fluid_adriver.c.orig Sun Mar 15 18:02:15 2009
+++ src/fluid_adriver.c Tue Oct 13 20:55:26 2009
@@ -64,6 +64,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,
+#if SNDIO_SUPPORT
+fluid_audio_driver_t* new_fluid_sndio_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_driver_t* new_fluid_sndio_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);
+int delete_fluid_sndio_audio_driver(fluid_audio_driver_t* p);
+void fluid_sndio_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 },
@@ -129,6 +138,13 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
delete_fluid_jack_audio_driver,
fluid_jack_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 },
+#if SNDIO_SUPPORT
+ { "sndio",
+ new_fluid_sndio_audio_driver,
+ new_fluid_sndio_audio_driver2,
+ delete_fluid_sndio_audio_driver,
+ fluid_sndio_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);
@@ -230,6 +246,8 @@ void fluid_audio_driver_settings(fluid_settings_t* set
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0, NULL, NULL);
#elif OSS_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL);
+#elif SNDIO_SUPPORT
+ fluid_settings_register_str(settings, "audio.driver", "sndio", 0, NULL, NULL);
#elif COREAUDIO_SUPPORT
@@ -217,6 +235,9 @@ void fluid_audio_driver_settings(fluid_settings_t* set
fluid_settings_register_str(settings, "audio.driver", "coreaudio", 0, NULL, NULL);
#elif DSOUND_SUPPORT
@@ -255,6 +273,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");
+#if SNDIO_SUPPORT
+ fluid_settings_add_option(settings, "audio.driver", "sndio");
#endif
#if COREAUDIO_SUPPORT
fluid_settings_add_option(settings, "audio.driver", "coreaudio");

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_fluid_jack_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
--- src/fluid_jack.c.orig Sat Apr 5 15:42:46 2008
+++ src/fluid_jack.c Sat Apr 5 15:43:54 2008
@@ -83,7 +83,7 @@ fluid_jack_audio_driver_settings(fluid_settings_t* set
$OpenBSD: patch-src_fluid_jack_c,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/fluid_jack.c.orig Sun Mar 8 22:43:14 2009
+++ src/fluid_jack.c Tue Oct 13 20:47:41 2009
@@ -90,7 +90,7 @@ fluid_jack_audio_driver_settings(fluid_settings_t* set
{
fluid_settings_register_str(settings, "audio.jack.id", "fluidsynth", 0, NULL, NULL);
fluid_settings_register_str(settings, "audio.jack.multi", "no", 0, NULL, NULL);

View File

@ -1,34 +1,50 @@
$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*
--- src/fluid_mdriver.c.orig Sun Mar 8 21:31:02 2009
+++ src/fluid_mdriver.c Tue Oct 13 21:12:59 2009
@@ -46,6 +46,15 @@ fluid_midi_driver_t *new_fluid_jack_midi_driver (fluid
int delete_fluid_jack_midi_driver(fluid_midi_driver_t *p);
#endif
+/* SNDIO */
+#if SNDIO_SUPPORT
+fluid_midi_driver_t* new_fluid_sndio_midi_driver(fluid_settings_t* settings,
+ handle_midi_event_func_t handler,
+ void* event_handler_data);
+int delete_fluid_sndio_midi_driver(fluid_midi_driver_t* p);
+void fluid_sndio_midi_driver_settings(fluid_settings_t* settings);
+#endif
+
/* OSS */
-#if OSS_SUPPORT
+/* #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 */
@@ -118,6 +127,12 @@ struct fluid_mdriver_definition_t fluid_midi_drivers[]
delete_fluid_alsa_seq_driver,
fluid_alsa_seq_driver_settings },
#endif
+#if SNDIO_SUPPORT
+ { "sndio",
+ new_fluid_sndio_midi_driver,
+ delete_fluid_sndio_midi_driver,
+ fluid_sndio_midi_driver_settings },
+#endif
#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 */
{ "winmidi",
new_fluid_winmidi_driver,
@@ -152,6 +167,8 @@ void fluid_midi_driver_settings(fluid_settings_t* sett
fluid_settings_register_str(settings, "midi.driver", "jack", 0, NULL, NULL);
#elif OSS_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "oss", 0, NULL, NULL);
+#elif SNDIO_SUPPORT
+ fluid_settings_register_str(settings, "midi.driver", "sndio", 0, NULL, NULL);
#elif WINMIDI_SUPPORT
fluid_settings_register_str(settings, "midi.driver", "winmidi", 0, NULL, NULL);
#elif MIDISHARE_SUPPORT
@@ -166,6 +183,9 @@ void fluid_midi_driver_settings(fluid_settings_t* sett
#if ALSA_SUPPORT
{ "alsa_raw",
new_fluid_alsa_rawmidi_driver,
fluid_settings_add_option(settings, "midi.driver", "alsa_seq");
fluid_settings_add_option(settings, "midi.driver", "alsa_raw");
+#endif
+#if SNDIO_SUPPORT
+ fluid_settings_add_option(settings, "midi.driver", "sndio");
#endif
#if JACK_SUPPORT
fluid_settings_add_option(settings, "midi.driver", "jack");

View File

@ -1,99 +0,0 @@
$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 Sat Dec 20 17:57:57 2008
@@ -34,6 +34,9 @@
#include <sys/soundcard.h>
#include <sys/ioctl.h>
+
+#endif /*#if OSS_SUPPORT */
+
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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)
@@ -639,10 +646,11 @@ fluid_oss_audio_run2(void* d)
return 0; /* not reached */
}
+#endif /*#if OSS_SUPPORT */
void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
{
- fluid_settings_register_str(settings, "midi.oss.device", "/dev/midi", 0, NULL, NULL);
+ fluid_settings_register_str(settings, "midi.oss.device", DEVOSSMIDI, 0, NULL, NULL);
}
/*
@@ -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;
+#if !defined(__OpenBSD__)
int sched = SCHED_FIFO;
struct sched_param priority;
+#endif
char* device;
/* not much use doing anything */
@@ -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) {
- device = "/dev/midi";
+ device = DEVOSSMIDI;
}
/* open the default hardware device. only use midi in. */
@@ -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;
}
+
+#if defined(__OpenBSD__)
+ err = pthread_create(&dev->thread, &attr, fluid_oss_midi_run, (void*) dev);
+ if (err) {
+ FLUID_LOG(FLUID_ERR, "Couldn't create midi thread");
+ goto error_recovery;
+ }
+#else
/* use fifo scheduling. if it fails, use default scheduling. */
while (1) {
err = pthread_attr_setschedpolicy(&attr, sched);
@@ -735,6 +753,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
}
break;
}
+#endif /* __OpenBSD__ */
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,7 +1,7 @@
$OpenBSD: patch-src_fluid_synth_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
--- src/fluid_synth.c.orig Sat Apr 5 15:21:35 2008
+++ src/fluid_synth.c Sat Apr 5 15:21:51 2008
@@ -127,7 +127,7 @@ void fluid_synth_settings(fluid_settings_t* settings)
$OpenBSD: patch-src_fluid_synth_c,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/fluid_synth.c.orig Sun Mar 15 20:01:36 2009
+++ src/fluid_synth.c Tue Oct 13 20:47:41 2009
@@ -128,7 +128,7 @@ void fluid_synth_settings(fluid_settings_t* settings)
fluid_settings_register_int(settings, "synth.effects-channels",
2, 2, 2, 0, NULL, NULL);
fluid_settings_register_num(settings, "synth.sample-rate",

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_fluid_sys_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
--- src/fluid_sys.c.orig Sun Nov 11 11:47:30 2007
+++ src/fluid_sys.c Fri Feb 15 17:09:36 2008
@@ -709,8 +709,10 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
$OpenBSD: patch-src_fluid_sys_c,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/fluid_sys.c.orig Tue Feb 3 23:29:24 2009
+++ src/fluid_sys.c Tue Oct 13 20:47:41 2009
@@ -889,8 +889,10 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
{
pthread_attr_t *attr = NULL;
pthread_attr_t rt_attr;
@ -12,7 +12,7 @@ $OpenBSD: patch-src_fluid_sys_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
int err;
fluid_timer_t* timer = FLUID_NEW(fluid_timer_t);
@@ -726,6 +728,7 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
@@ -906,6 +908,7 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
timer->auto_destroy = auto_destroy;
err = pthread_attr_init(&rt_attr);
@ -20,7 +20,7 @@ $OpenBSD: patch-src_fluid_sys_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
if (err == 0) {
err = pthread_attr_setschedpolicy(&rt_attr, SCHED_FIFO);
if (err == 0) {
@@ -736,6 +739,7 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
@@ -916,6 +919,7 @@ new_fluid_timer(int msec, fluid_timer_callback_t callb
}
}
}

View File

@ -1,12 +1,12 @@
$OpenBSD: patch-src_fluidsynth_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
--- src/fluidsynth.c.orig Sun Nov 11 02:09:48 2007
+++ src/fluidsynth.c Fri Feb 15 17:09:36 2008
$OpenBSD: patch-src_fluidsynth_c,v 1.2 2009/10/15 15:44:50 jakemsr Exp $
--- src/fluidsynth.c.orig Tue Feb 3 23:45:02 2009
+++ src/fluidsynth.c Tue Oct 13 20:57:00 2009
@@ -212,9 +212,9 @@ int main(int argc, char** argv)
int audio_channels = 0;
int with_server = 0;
int dump = 0;
- int connect_lash = 1;
char *optchars = "a:C:c:df:G:g:hijK:L:lm:no:R:r:sVvz:";
char *optchars = "a:C:c:df:G:g:hijK:L:lm:no:p:R:r:sVvz:";
#ifdef LASH_ENABLED
+ int connect_lash = 1;
int enabled_lash = 0; /* set to TRUE if lash gets enabled */
@ -22,7 +22,7 @@ $OpenBSD: patch-src_fluidsynth_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
{"dump", 0, 0, 'd'},
{"gain", 1, 0, 'g'},
{"help", 0, 0, 'h'},
@@ -343,9 +345,11 @@ int main(int argc, char** argv)
@@ -344,9 +346,11 @@ int main(int argc, char** argv)
audio_channels = atoi(optarg);
fluid_settings_setint(settings, "synth.audio-channels", audio_channels);
break;
@ -34,7 +34,7 @@ $OpenBSD: patch-src_fluidsynth_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
case 'm':
fluid_settings_setstr(settings, "midi.driver", optarg);
break;
@@ -417,12 +421,14 @@ int main(int argc, char** argv)
@@ -421,12 +425,14 @@ int main(int argc, char** argv)
#endif
#ifdef LASH_ENABLED