internal data is converted from float to native endian integer data.

configure 16-bit output for cpu native endian encoding.
This commit is contained in:
jakemsr 2008-04-20 11:19:20 +00:00
parent e70f233e4f
commit 0df171533b
2 changed files with 49 additions and 15 deletions

View File

@ -1,7 +1,8 @@
# $OpenBSD: Makefile,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
# $OpenBSD: Makefile,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
COMMENT = SoundFont2 software synthesizer
DISTNAME = fluidsynth-1.0.8
PKGNAME = ${DISTNAME}p0
SHARED_LIBS = fluidsynth 0.0

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
$OpenBSD: patch-src_fluid_oss_c,v 1.2 2008/04/20 11:19:20 jakemsr Exp $
--- src/fluid_oss.c.orig Tue Sep 18 23:10:57 2007
+++ src/fluid_oss.c Sun Feb 17 21:36:28 2008
+++ src/fluid_oss.c Sun Apr 20 03:40:45 2008
@@ -32,8 +32,13 @@
#if OSS_SUPPORT
@ -35,7 +35,19 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if (dev == NULL) {
@@ -168,7 +175,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
@@ -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)) {
@ -44,7 +56,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
}
if (stat(devname, &devstat) == -1) {
@@ -229,6 +236,13 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
@@ -229,6 +240,13 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
goto error_recovery;
}
@ -58,7 +70,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
/* 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 +278,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
@@ -264,6 +282,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings,
}
break;
}
@ -66,7 +78,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
return (fluid_audio_driver_t*) dev;
@@ -285,8 +300,10 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
@@ -285,8 +304,10 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
int format;
pthread_attr_t attr;
int err;
@ -77,7 +89,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
dev = FLUID_NEW(fluid_oss_audio_driver_t);
if (dev == NULL) {
@@ -311,7 +328,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
@@ -311,7 +332,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
if (!fluid_settings_getstr(settings, "audio.oss.device", &devname)) {
@ -86,7 +98,28 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
}
if (stat(devname, &devstat) == -1) {
FLUID_LOG(FLUID_ERR, "Device <%s> does not exists", devname);
@@ -380,6 +397,13 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
@@ -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;
}
@ -100,7 +133,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
/* 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 +439,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
@@ -415,6 +451,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings
}
break;
}
@ -108,7 +141,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
return (fluid_audio_driver_t*) dev;
@@ -642,7 +667,7 @@ fluid_oss_audio_run2(void* d)
@@ -642,7 +679,7 @@ fluid_oss_audio_run2(void* d)
void fluid_oss_midi_driver_settings(fluid_settings_t* settings)
{
@ -117,7 +150,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
}
/*
@@ -655,8 +680,10 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -655,8 +692,10 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
int err;
fluid_oss_midi_driver_t* dev;
pthread_attr_t attr;
@ -128,7 +161,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
char* device;
/* not much use doing anything */
@@ -687,7 +714,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -687,7 +726,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) {
@ -137,7 +170,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
}
/* open the default hardware device. only use midi in. */
@@ -704,6 +731,14 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -704,6 +743,14 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
FLUID_LOG(FLUID_ERR, "Couldn't initialize midi thread attributes");
goto error_recovery;
}
@ -152,7 +185,7 @@ $OpenBSD: patch-src_fluid_oss_c,v 1.1.1.1 2008/04/06 22:42:11 jakemsr Exp $
/* use fifo scheduling. if it fails, use default scheduling. */
while (1) {
err = pthread_attr_setschedpolicy(&attr, sched);
@@ -735,6 +770,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
@@ -735,6 +782,7 @@ new_fluid_oss_midi_driver(fluid_settings_t* settings,
}
break;
}