Merge pull request #207 from FluidSynth/cleanup

source code cleanup, API compatibility broken
This commit is contained in:
Tom M 2017-09-22 14:10:38 +02:00 committed by GitHub
commit 2a3ff1d2cf
65 changed files with 544 additions and 3049 deletions

View file

@ -83,11 +83,11 @@ if ( OSS_SUPPORT )
set ( fluid_oss_SOURCES drivers/fluid_oss.c )
endif ( OSS_SUPPORT )
if ( LASH_SUPPORT OR LADCCA_SUPPORT )
if ( LASH_SUPPORT )
set ( fluid_lash_SOURCES bindings/fluid_lash.c bindings/fluid_lash.h )
include_directories ( ${LASH_INCLUDEDIR} ${LADCCA_INCLUDEDIR}
${LASH_INCLUDE_DIRS} ${LADCCA_INCLUDE_DIRS} )
endif ( LASH_SUPPORT OR LADCCA_SUPPORT )
include_directories ( ${LASH_INCLUDEDIR}
${LASH_INCLUDE_DIRS})
endif ( LASH_SUPPORT )
if ( DART_SUPPORT )
set ( fluid_dart_SOURCES drivers/fluid_dart.c )
@ -210,8 +210,6 @@ link_directories (
${GLIB_LIBRARY_DIRS}
${LASH_LIBDIR}
${LASH_LIBRARY_DIRS}
${LADCCA_LIBDIR}
${LADCCA_LIBRARY_DIRS}
${JACK_LIBDIR}
${JACK_LIBRARY_DIRS}
${ALSA_LIBDIR}
@ -289,7 +287,6 @@ endif ( LIBFLUID_CPPFLAGS )
target_link_libraries ( libfluidsynth
${GLIB_LIBRARIES}
${LASH_LIBRARIES}
${LADCCA_LIBRARIES}
${JACK_LIBRARIES}
${ALSA_LIBRARIES}
${PULSE_LIBRARIES}

View file

@ -1,198 +0,0 @@
## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = subdir-objects
# Tests for optional drivers
if PULSE_SUPPORT
fluid_pulse = drivers/fluid_pulse.c
endif
if ALSA_SUPPORT
fluid_alsa = drivers/fluid_alsa.c
endif
if COREAUDIO_SUPPORT
fluid_coreaudio = drivers/fluid_coreaudio.c
endif
if COREMIDI_SUPPORT
fluid_coremidi = drivers/fluid_coremidi.c
endif
if DBUS_SUPPORT
fluid_rtkit = bindings/fluid_rtkit.c bindings/fluid_rtkit.h
endif
if JACK_SUPPORT
fluid_jack = drivers/fluid_jack.c
endif
if PORTAUDIO_SUPPORT
fluid_portaudio = drivers/fluid_portaudio.c
endif
if MINGW32_SUPPORT
fluid_windows = fluid_dll.c drivers/fluid_dsound.c drivers/fluid_winmidi.c
endif
if OSS_SUPPORT
fluid_oss = drivers/fluid_oss.c
endif
# if LASH_SUPPORT || LADCCA_SUPPORT (Makefile supports OR?)
if LASH_SUPPORT
fluid_lash = bindings/fluid_lash.c bindings/fluid_lash.h
else
if LADCCA_SUPPORT
fluid_lash = bindings/fluid_lash.c bindings/fluid_lash.h
endif
endif
if DART_SUPPORT
fluid_dart = drivers/fluid_dart.c
endif
# Extra files and optional drivers
EXTRA_DIST = fluid_dll.c \
bindings/fluid_ladspa.c \
bindings/fluid_ladspa.h \
drivers/fluid_alsa.c \
drivers/fluid_coreaudio.c \
drivers/fluid_coremidi.c \
drivers/fluid_dart.c \
drivers/fluid_dsound.c \
drivers/fluid_jack.c \
drivers/fluid_midishare.c \
drivers/fluid_oss.c \
drivers/fluid_portaudio.c \
drivers/fluid_pulse.c \
drivers/fluid_sndmgr.c \
drivers/fluid_winmidi.c \
config_macos.h \
config_macosx.h \
config_macosx_pb.h \
CMakeLists.txt \
config_win32.cmake \
config_win32.h.in \
config.cmake
DISTCLEANFILES = config_win32.h
lib_LTLIBRARIES = libfluidsynth.la
bin_PROGRAMS = fluidsynth
libfluidsynth_la_SOURCES = \
$(fluid_alsa) \
$(fluid_coreaudio) \
$(fluid_coremidi) \
$(fluid_jack) \
$(fluid_ladspa) \
$(fluid_lash) \
$(fluid_oss) \
$(fluid_portaudio) \
$(fluid_pulse) \
$(fluid_windows) \
$(fluid_dart) \
$(fluid_rtkit) \
utils/fluid_conv.c \
utils/fluid_conv.h \
utils/fluid_hash.c \
utils/fluid_hash.h \
utils/fluid_list.c \
utils/fluid_list.h \
utils/fluid_ringbuffer.c \
utils/fluid_ringbuffer.h \
utils/fluid_settings.c \
utils/fluid_settings.h \
utils/fluidsynth_priv.h \
utils/fluid_sys.c \
utils/fluid_sys.h \
sfloader/fluid_defsfont.c \
sfloader/fluid_defsfont.h \
sfloader/fluid_ramsfont.c \
sfloader/fluid_ramsfont.h \
sfloader/fluid_sfont.h \
rvoice/fluid_adsr_env.c \
rvoice/fluid_adsr_env.h \
rvoice/fluid_chorus.c \
rvoice/fluid_chorus.h \
rvoice/fluid_iir_filter.c \
rvoice/fluid_iir_filter.h \
rvoice/fluid_lfo.c \
rvoice/fluid_lfo.h \
rvoice/fluid_rvoice.h \
rvoice/fluid_rvoice.c \
rvoice/fluid_rvoice_dsp.c \
rvoice/fluid_rvoice_event.h \
rvoice/fluid_rvoice_event.c \
rvoice/fluid_rvoice_mixer.h \
rvoice/fluid_rvoice_mixer.c \
rvoice/fluid_phase.h \
rvoice/fluid_rev.c \
rvoice/fluid_rev.h \
synth/fluid_chan.c \
synth/fluid_chan.h \
synth/fluid_event.c \
synth/fluid_event_priv.h \
synth/fluid_gen.c \
synth/fluid_gen.h \
synth/fluid_mod.c \
synth/fluid_mod.h \
synth/fluid_synth.c \
synth/fluid_synth.h \
synth/fluid_tuning.c \
synth/fluid_tuning.h \
synth/fluid_voice.c \
synth/fluid_voice.h \
midi/fluid_midi.c \
midi/fluid_midi.h \
midi/fluid_midi_router.c \
midi/fluid_midi_router.h \
midi/fluid_seqbind.c \
midi/fluid_seq.c \
drivers/fluid_adriver.c \
drivers/fluid_adriver.h \
drivers/fluid_mdriver.c \
drivers/fluid_mdriver.h \
drivers/fluid_aufile.c \
bindings/fluid_cmd.c \
bindings/fluid_cmd.h \
bindings/fluid_ladspa.c \
bindings/fluid_ladspa.h \
bindings/fluid_filerenderer.c
INCLUDES = -I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/drivers \
-I$(top_srcdir)/src/synth \
-I$(top_srcdir)/src/rvoice \
-I$(top_srcdir)/src/midi \
-I$(top_srcdir)/src/utils \
-I$(top_srcdir)/src/sfloader \
-I$(top_srcdir)/src/bindings \
$(LASH_CFLAGS) $(LADCCA_CFLAGS) \
$(READLINE_CFLAGS) $(JACK_CFLAGS) $(ALSA_CFLAGS) $(PULSE_CFLAGS) \
$(PORTAUDIO_CFLAGS) $(DART_CFLAGS) $(GLIB_CFLAGS) $(LIBSNDFILE_CFLAGS) \
$(DBUS_CFLAGS)
libfluidsynth_la_LIBADD = $(LIBFLUID_LIBS) $(LASH_LIBS) $(LADCCA_LIBS) \
$(READLINE_LIBS) $(COREAUDIO_LIBS) $(COREMIDI_LIBS) $(JACK_LIBS) \
$(ALSA_LIBS) $(PULSE_LIBS) $(PORTAUDIO_LIBS) $(DART_LIBS) \
$(GLIB_LIBS) $(LIBSNDFILE_LIBS) $(DBUS_LIBS)
libfluidsynth_la_LDFLAGS = \
-version-info @LT_VERSION_INFO@ \
-export-dynamic $(LIBFLUID_LDFLAGS)
libfluidsynth_la_CPPFLAGS = $(LIBFLUID_CPPFLAGS)
fluidsynth_SOURCES = fluidsynth.c
fluidsynth_LDADD = libfluidsynth.la
fluidsynth_CPPFLAGS = $(FLUIDSYNTH_CPPFLAGS)
if GNU_LD_SUPPORT
fluidsynth_LDFLAGS = -Wl,--as-needed
endif

View file

@ -584,11 +584,15 @@ fluid_handle_channels(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t o
if (!verbose)
fluid_ostream_printf (out, "chan %d, %s\n", i,
info.assigned ? info.name : "no preset");
info.preset!=NULL
? fluid_preset_get_name(info.preset)
: "no preset");
else
fluid_ostream_printf (out, "chan %d, sfont %d, bank %d, preset %d, %s\n", i,
info.sfont_id, info.bank, info.program,
info.assigned ? info.name : "no preset");
info.preset!=NULL
? fluid_preset_get_name(info.preset)
: "no preset");
}
return 0;
@ -1294,25 +1298,24 @@ fluid_handle_set(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out)
fluid_ostream_printf (out, "set: Parameter '%s' not found.\n", av[0]);
break;
case FLUID_INT_TYPE:
hints = fluid_settings_get_hints (synth->settings, av[0]);
if (hints & FLUID_HINT_TOGGLED)
if (fluid_settings_get_hints (synth->settings, av[0], &hints) == FLUID_OK
&& hints & FLUID_HINT_TOGGLED)
{
if (FLUID_STRCMP (av[1], "yes") == 0 || FLUID_STRCMP (av[1], "True") == 0
|| FLUID_STRCMP (av[1], "TRUE") == 0 || FLUID_STRCMP (av[1], "true") == 0
|| FLUID_STRCMP (av[1], "T") == 0)
if (FLUID_STRCMP (av[1], "yes") == 0 || FLUID_STRCMP (av[1], "True") == 0
|| FLUID_STRCMP (av[1], "TRUE") == 0 || FLUID_STRCMP (av[1], "true") == 0
|| FLUID_STRCMP (av[1], "T") == 0)
ival = 1;
else ival = atoi (av[1]);
else ival = atoi (av[1]);
}
else ival = atoi (av[1]);
fluid_synth_setint (synth, av[0], ival);
fluid_settings_setint (synth->settings, av[0], ival);
break;
case FLUID_NUM_TYPE:
fluid_synth_setnum (synth, av[0], atof (av[1]));
fluid_settings_setnum (synth->settings, av[0], atof (av[1]));
break;
case FLUID_STR_TYPE:
fluid_synth_setstr(synth, av[0], av[1]);
fluid_settings_setstr(synth->settings, av[0], av[1]);
break;
case FLUID_SET_TYPE:
fluid_ostream_printf (out, "set: Parameter '%s' is a node.\n", av[0]);
@ -1337,21 +1340,21 @@ fluid_handle_get(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out)
case FLUID_NUM_TYPE: {
double value;
fluid_synth_getnum(synth, av[0], &value);
fluid_settings_getnum(synth->settings, av[0], &value);
fluid_ostream_printf(out, "%.3f", value);
break;
}
case FLUID_INT_TYPE: {
int value;
fluid_synth_getint(synth, av[0], &value);
fluid_settings_getint(synth->settings, av[0], &value);
fluid_ostream_printf(out, "%d", value);
break;
}
case FLUID_STR_TYPE: {
char* s;
fluid_synth_dupstr(synth, av[0], &s); /* ++ alloc string */
fluid_settings_dupstr(synth->settings, av[0], &s); /* ++ alloc string */
fluid_ostream_printf(out, "%s", s ? s : "NULL");
if (s) FLUID_FREE (s); /* -- free string */
break;
@ -1395,25 +1398,27 @@ static void fluid_handle_settings_iter2(void* data, char* name, int type)
switch (fluid_settings_get_type(fluid_synth_get_settings(d->synth), name)) {
case FLUID_NUM_TYPE: {
double value;
fluid_synth_getnum(d->synth, name, &value);
fluid_settings_getnum(d->synth->settings, name, &value);
fluid_ostream_printf(d->out, "%.3f\n", value);
break;
}
case FLUID_INT_TYPE: {
int value, hints;
fluid_synth_getint(d->synth, name, &value);
hints = fluid_settings_get_hints (d->synth->settings, name);
if (!(hints & FLUID_HINT_TOGGLED))
fluid_ostream_printf(d->out, "%d\n", value);
else fluid_ostream_printf(d->out, "%s\n", value ? "True" : "False");
fluid_settings_getint(d->synth->settings, name, &value);
if(fluid_settings_get_hints (d->synth->settings, name, &hints) == FLUID_OK)
{
if (!(hints & FLUID_HINT_TOGGLED))
fluid_ostream_printf(d->out, "%d\n", value);
else fluid_ostream_printf(d->out, "%s\n", value ? "True" : "False");
}
break;
}
case FLUID_STR_TYPE: {
char* s;
fluid_synth_dupstr(d->synth, name, &s); /* ++ alloc string */
fluid_settings_dupstr(d->synth->settings, name, &s); /* ++ alloc string */
fluid_ostream_printf(d->out, "%s\n", s ? s : "NULL");
if (s) FLUID_FREE (s); /* -- free string */
break;
@ -1470,48 +1475,59 @@ fluid_handle_info(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out)
return -1;
case FLUID_NUM_TYPE: {
double value, min, max;
fluid_settings_getnum_range(settings, av[0], &min, &max);
fluid_settings_getnum(settings, av[0], &value);
fluid_ostream_printf(out, "%s:\n", av[0]);
fluid_ostream_printf(out, "Type: number\n");
fluid_ostream_printf(out, "Value: %.3f\n", value);
fluid_ostream_printf(out, "Minimum value: %.3f\n", min);
fluid_ostream_printf(out, "Maximum value: %.3f\n", max);
fluid_ostream_printf(out, "Default value: %.3f\n",
fluid_settings_getnum_default(settings, av[0]));
fluid_ostream_printf(out, "Real-time: %s\n",
fluid_settings_is_realtime(settings, av[0])? "yes" : "no");
double value, min, max, def;
if(fluid_settings_getnum_range(settings, av[0], &min, &max) == FLUID_OK
&& fluid_settings_getnum(settings, av[0], &value) == FLUID_OK
&& fluid_settings_getnum_default(settings, av[0], &def) == FLUID_OK)
{
fluid_ostream_printf(out, "%s:\n", av[0]);
fluid_ostream_printf(out, "Type: number\n");
fluid_ostream_printf(out, "Value: %.3f\n", value);
fluid_ostream_printf(out, "Minimum value: %.3f\n", min);
fluid_ostream_printf(out, "Maximum value: %.3f\n", max);
fluid_ostream_printf(out, "Default value: %.3f\n", def);
fluid_ostream_printf(out, "Real-time: %s\n",
fluid_settings_is_realtime(settings, av[0])? "yes" : "no");
}
else
{
fluid_ostream_printf(out, "An error occurred when processing %s\n", av[0]);
}
break;
}
case FLUID_INT_TYPE: {
int value, min, max, def, hints;
fluid_settings_getint_range(settings, av[0], &min, &max);
fluid_settings_getint(settings, av[0], &value);
hints = fluid_settings_get_hints(settings, av[0]);
def = fluid_settings_getint_default (settings, av[0]);
fluid_ostream_printf(out, "%s:\n", av[0]);
if (!(hints & FLUID_HINT_TOGGLED))
if(fluid_settings_getint_range(settings, av[0], &min, &max) == FLUID_OK
&& fluid_settings_getint(settings, av[0], &value) == FLUID_OK
&& fluid_settings_get_hints(settings, av[0], &hints) == FLUID_OK
&& fluid_settings_getint_default (settings, av[0], &def) == FLUID_OK)
{
fluid_ostream_printf(out, "Type: integer\n");
fluid_ostream_printf(out, "Value: %d\n", value);
fluid_ostream_printf(out, "Minimum value: %d\n", min);
fluid_ostream_printf(out, "Maximum value: %d\n", max);
fluid_ostream_printf(out, "Default value: %d\n", def);
fluid_ostream_printf(out, "%s:\n", av[0]);
if (!(hints & FLUID_HINT_TOGGLED))
{
fluid_ostream_printf(out, "Type: integer\n");
fluid_ostream_printf(out, "Value: %d\n", value);
fluid_ostream_printf(out, "Minimum value: %d\n", min);
fluid_ostream_printf(out, "Maximum value: %d\n", max);
fluid_ostream_printf(out, "Default value: %d\n", def);
}
else
{
fluid_ostream_printf(out, "Type: boolean\n");
fluid_ostream_printf(out, "Value: %s\n", value ? "True" : "False");
fluid_ostream_printf(out, "Default value: %s\n", def ? "True" : "False");
}
fluid_ostream_printf(out, "Real-time: %s\n",
fluid_settings_is_realtime(settings, av[0])? "yes" : "no");
}
else
{
fluid_ostream_printf(out, "Type: boolean\n");
fluid_ostream_printf(out, "Value: %s\n", value ? "True" : "False");
fluid_ostream_printf(out, "Default value: %s\n", def ? "True" : "False");
fluid_ostream_printf(out, "An error occurred when processing %s\n", av[0]);
}
fluid_ostream_printf(out, "Real-time: %s\n",
fluid_settings_is_realtime(settings, av[0])? "yes" : "no");
break;
}

View file

@ -68,14 +68,14 @@ void fluid_LADSPA_CreateSystemNodes(fluid_LADSPA_FxUnit_t* FxUnit){
int i;
/* Retrieve the number of synth / audio out / Fx send nodes */
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-groups", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-groups", &temp) == FLUID_OK);
nr_input_nodes=(int) temp;
printf("%i audio groups\n", nr_input_nodes);
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-channels", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-channels", &temp) == FLUID_OK);
nr_output_nodes=temp;
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.effects-channels", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.effects-channels", &temp) == FLUID_OK);
nr_fx_input_nodes=temp;
/* Create regular input nodes (associated with audio groups) */
@ -709,13 +709,13 @@ fluid_LADSPA_run(fluid_LADSPA_FxUnit_t* FxUnit, fluid_real_t* left_buf[], fluid_
int temp;
/* Retrieve the number of synth / audio out / Fx send nodes */
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-groups", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-groups", &temp) == FLUID_OK);
nr_groups=(int) temp;
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-channels", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.audio-channels", &temp) == FLUID_OK);
nr_audio_channels=temp;
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.effects-channels", &temp));
assert(fluid_settings_getint(FxUnit->synth->settings, "synth.effects-channels", &temp) == FLUID_OK);
nr_fx_sends=temp;
/* Fixme: Retrieving nodes via names is inefficient

View file

@ -37,8 +37,6 @@ static void *fluid_lash_run (void * data);
*/
#ifdef HAVE_LASH
lash_client_t * fluid_lash_client;
#else
cca_client_t * fluid_lash_client;
#endif
static pthread_t fluid_lash_thread;
@ -169,132 +167,4 @@ fluid_lash_run (void * data)
return NULL;
}
#else /* deprecated LADCCA support, will remove someday */
fluid_lash_args_t *
fluid_lash_extract_args (int * pargc, char *** pargv)
{
return cca_extract_args (pargc, pargv);
}
int
fluid_lash_connect (fluid_lash_args_t * args)
{
fluid_lash_client = cca_init (args, PACKAGE, CCA_Config_Data_Set | CCA_Terminal, CCA_PROTOCOL (2,0));
return fluid_lash_client && cca_enabled (fluid_lash_client);
}
void
fluid_lash_create_thread (fluid_synth_t * synth)
{
pthread_create (&fluid_lash_thread, NULL, fluid_lash_run, synth);
}
static void
fluid_lash_save (fluid_synth_t * synth)
{
int i;
int sfcount;
fluid_sfont_t * sfont;
cca_config_t * config;
char num[32];
sfcount = fluid_synth_sfcount (synth);
config = cca_config_new ();
cca_config_set_key (config, "soundfont count");
cca_config_set_value_int (config, sfcount);
cca_send_config (fluid_lash_client, config);
for (i = sfcount - 1; i >= 0; i--)
{
sfont = fluid_synth_get_sfont (synth, i);
config = cca_config_new ();
sprintf (num, "%d", i);
cca_config_set_key (config, num);
cca_config_set_value_string (config, sfont->get_name (sfont));
cca_send_config (fluid_lash_client, config);
}
}
static void
fluid_lash_load (fluid_synth_t * synth, const char * filename)
{
fluid_synth_sfload (synth, filename, 1);
}
/* LADCCA thread */
static void *
fluid_lash_run (void * data)
{
cca_event_t * event;
cca_config_t * config;
fluid_synth_t * synth;
int done = 0;
int err;
int pending_restores = 0;
synth = (fluid_synth_t *) data;
while (!done)
{
while ( (event = cca_get_event (fluid_lash_client)) )
{
switch (cca_event_get_type (event))
{
case CCA_Save_Data_Set:
fluid_lash_save (synth);
cca_send_event (fluid_lash_client, event);
break;
case CCA_Restore_Data_Set:
cca_event_destroy (event);
break;
case CCA_Quit:
err = kill (getpid(), SIGQUIT);
if (err)
fprintf (stderr, "%s: error sending signal: %s",
__FUNCTION__, strerror (errno));
cca_event_destroy (event);
done = 1;
break;
case CCA_Server_Lost:
cca_event_destroy (event);
done = 1;
break;
default:
fprintf (stderr, "Received unknown LADCCA event of type %d\n", cca_event_get_type (event));
cca_event_destroy (event);
break;
}
}
while ( (config = cca_get_config (fluid_lash_client)) )
{
if (strcmp (cca_config_get_key (config), "soundfont count") == 0)
pending_restores = cca_config_get_value_int (config);
else
{
fluid_lash_load (synth, cca_config_get_value_string (config));
pending_restores--;
}
cca_config_destroy (config);
if (!pending_restores)
{
event = cca_event_new_with_type (CCA_Restore_Data_Set);
cca_send_event (fluid_lash_client, event);
}
}
usleep (10000);
}
return NULL;
}
#endif /* #if HAVE_LASH #else */

View file

@ -21,7 +21,7 @@
#include "config.h"
#endif
#if defined(HAVE_LASH) || defined(HAVE_LADCCA)
#if defined(HAVE_LASH)
#include "fluid_synth.h"
@ -35,14 +35,6 @@ extern lash_client_t * fluid_lash_client;
#define fluid_lash_alsa_client_id lash_alsa_client_id
#define fluid_lash_jack_client_name lash_jack_client_name
#else /* old deprecated LADCCA support which will be removed someday */
#include <ladcca/ladcca.h>
extern cca_client_t * fluid_lash_client;
#define fluid_lash_args_t cca_args_t
#define fluid_lash_alsa_client_id cca_alsa_client_id
#define fluid_lash_jack_client_name cca_jack_client_name
#endif
@ -50,4 +42,4 @@ FLUIDSYNTH_API fluid_lash_args_t *fluid_lash_extract_args (int * pargc, char ***
FLUIDSYNTH_API int fluid_lash_connect (fluid_lash_args_t * args);
FLUIDSYNTH_API void fluid_lash_create_thread (fluid_synth_t * synth);
#endif /* defined(HAVE_LASH) || defined(HAVE_LADCCA) */
#endif /* defined(HAVE_LASH) */

View file

@ -43,9 +43,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@
/* whether or not we are supporting ladcca */
#cmakedefine HAVE_LADCCA @HAVE_LADCCA@
/* whether or not we are supporting lash */
#cmakedefine HAVE_LASH @HAVE_LASH@

View file

@ -1,26 +0,0 @@
#define VERSION FLUIDSYNTH_VERSION
#define MACOS9
#define MACINTOSH
#define HAVE_STRING_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDIO_H 1
#define HAVE_MATH_H 1
#define HAVE_STDARG_H 1
#define WORDS_BIGENDIAN 1
#define HAVE_LIMITS_H 1
#define HAVE_FCNTL_H 1
#undef WITH_PROFILING
#define WITHOUT_SERVER 1
/**** define to use the macintosh sound manager driver*/
#define SNDMAN_SUPPORT 1
/**** define to use the portaudio driver */
/* #define PORTAUDIO_SUPPORT 1 */
/**** define to use the MidiShare driver */
/* #define MIDISHARE_SUPPORT 1 */
/* #define MIDISHARE_DRIVER 1 */
/* #define MidiSharePPC_68k */

View file

@ -1,22 +0,0 @@
#define MACINTOSH
#define HAVE_STRING_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDIO_H 1
#define HAVE_MATH_H 1
#define HAVE_STDARG_H 1
#define WORDS_BIGENDIAN 1
#undef WITH_PROFILING
/* define to support the MidiShare driver */
#define MIDISHARE_SUPPORT 1
#define MIDISHARE_DRIVER 1
#define PORTAUDIO_SUPPORT 1
#define PORTMIDI_SUPPORT 1
#define __Types__
/* define to support DARWIN */
#define DARWIN
typedef int socklen_t

View file

@ -1,38 +0,0 @@
#define VERSION "1.0.x"
#define MACINTOSH
/* define to support DARWIN */
#define DARWIN
#define HAVE_STRING_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDIO_H 1
#define HAVE_MATH_H 1
#define HAVE_STDARG_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_FCNTL_H 1
#define HAVE_UNISTD_H 1
#define HAVE_LIMITS_H 1
#define HAVE_PTHREAD_H 1
#define WORDS_BIGENDIAN 1
#define DEBUG 1
#undef WITH_PROFILING
#define WITHOUT_SERVER 1
#define COREAUDIO_SUPPORT 1
#define COREMIDI_SUPPORT 1
/* define to support the MidiShare driver */
/*
#define MIDISHARE_SUPPORT 1
#define MIDISHARE_DRIVER 1
#define PORTAUDIO_SUPPORT 1
#define __Types__
*/
typedef int socklen_t

View file

@ -1,43 +0,0 @@
#define VERSION "@VERSION@"
#define HAVE_STRING_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDIO_H 1
#define HAVE_MATH_H 1
#define HAVE_STDARG_H 1
#define HAVE_FCNTL_H 1
#define HAVE_LIMITS_H 1
#define HAVE_IO_H 1
#define HAVE_WINDOWS_H 1
#define DSOUND_SUPPORT 1
#define WINMIDI_SUPPORT 1
#define WITH_FLOAT 1
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#if _MSC_VER < 1500
#define vsnprintf _vsnprintf
#endif
#define STDIN_FILENO 0
#define STDOUT_FILENO 1
#define STDERR_FILENO 2
#define WITH_PROFILING 0
#pragma warning(disable : 4244)
#pragma warning(disable : 4101)
#pragma warning(disable : 4305)
#pragma warning(disable : 4996)
#ifndef inline
#define inline __inline
#endif
typedef int socklen_t;

View file

@ -204,10 +204,6 @@ void fluid_audio_driver_settings(fluid_settings_t* settings)
fluid_settings_add_option(settings, "audio.sample-format", "16bits");
fluid_settings_add_option(settings, "audio.sample-format", "float");
fluid_settings_register_int(settings, "audio.output-channels", 2, 2, 32, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.input-channels", 0, 0, 2, 0, NULL, NULL);
#if defined(WIN32)
fluid_settings_register_int(settings, "audio.period-size", 512, 64, 8192, 0, NULL, NULL);
fluid_settings_register_int(settings, "audio.periods", 8, 2, 64, 0, NULL, NULL);

View file

@ -791,10 +791,10 @@ new_fluid_alsa_seq_driver(fluid_settings_t* settings,
fluid_settings_getint (settings, "midi.realtime-prio", &realtime_prio);
/* get the device name. if none is specified, use the default device. */
if (fluid_settings_dupstr(settings, "midi.alsa_seq.device", &device) == 0) /* ++ alloc device name */
if (fluid_settings_dupstr(settings, "midi.alsa_seq.device", &device) != FLUID_OK) /* ++ alloc device name */
goto error_recovery;
if (fluid_settings_dupstr(settings, "midi.alsa_seq.id", &id) == 0) /* ++ alloc id string */
if (fluid_settings_dupstr(settings, "midi.alsa_seq.id", &id) != FLUID_OK) /* ++ alloc id string */
goto error_recovery;
if (id == NULL) {

View file

@ -206,7 +206,7 @@ new_fluid_core_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func
fluid_settings_getint(settings, "audio.period-size", &period_size);
/* get the selected device name. if none is specified, use NULL for the default device. */
if (fluid_settings_dupstr(settings, "audio.coreaudio.device", &devname) /* alloc device name */
if (fluid_settings_dupstr(settings, "audio.coreaudio.device", &devname) == FLUID_OK /* alloc device name */
&& devname && strlen (devname) > 0) {
AudioObjectPropertyAddress pa;
pa.mSelector = kAudioHardwarePropertyDevices;

View file

@ -168,7 +168,7 @@ new_fluid_dsound_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
devsel.devGUID = NULL;
/* get the selected device name. if none is specified, use NULL for the default device. */
if(fluid_settings_dupstr(settings, "audio.dsound.device", &devsel.devname) /* ++ alloc device name */
if(fluid_settings_dupstr(settings, "audio.dsound.device", &devsel.devname) == FLUID_OK /* ++ alloc device name */
&& devsel.devname && strlen (devsel.devname) > 0) {
/* look for the GUID of the selected device */
DirectSoundEnumerate((LPDSENUMCALLBACK) fluid_dsound_enum_callback2, (void *)&devsel);

View file

@ -163,7 +163,7 @@ new_fluid_oss_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth)
goto error_recovery;
}
if (!fluid_settings_dupstr(settings, "audio.oss.device", &devname) || !devname) { /* ++ alloc device name */
if (fluid_settings_dupstr(settings, "audio.oss.device", &devname) != FLUID_OK || !devname) { /* ++ alloc device name */
devname = FLUID_STRDUP ("/dev/dsp");
if (devname == NULL) {
@ -277,7 +277,7 @@ new_fluid_oss_audio_driver2(fluid_settings_t* settings, fluid_audio_func_t func,
dev->buffer_byte_size = dev->buffer_size * 2 * 2; /* 2 channels * 16 bits audio */
if (!fluid_settings_dupstr(settings, "audio.oss.device", &devname) || !devname) {
if (fluid_settings_dupstr(settings, "audio.oss.device", &devname) != FLUID_OK || !devname) {
devname = FLUID_STRDUP ("/dev/dsp");
if (!devname)

View file

@ -99,7 +99,6 @@ new_fluid_pulse_audio_driver2(fluid_settings_t* settings,
FLUID_MEMSET(dev, 0, sizeof(fluid_pulse_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);
fluid_settings_dupstr(settings, "audio.pulseaudio.server", &server); /* ++ alloc server string */

View file

@ -132,7 +132,7 @@ new_fluid_winmidi_driver(fluid_settings_t* settings,
dev->closing = FALSE;
/* get the device name. if none is specified, use the default device. */
if(!fluid_settings_dupstr(settings, "midi.winmidi.device", &devname) || !devname) {
if(fluid_settings_dupstr(settings, "midi.winmidi.device", &devname) != FLUID_OK || !devname) {
devname = FLUID_STRDUP ("default");
if (!devname)

View file

@ -104,16 +104,15 @@ void process_o_cmd_line_option(fluid_settings_t* settings, char* optarg)
switch(fluid_settings_get_type(settings, optarg)){
case FLUID_NUM_TYPE:
if (!fluid_settings_setnum (settings, optarg, atof (val)))
if (fluid_settings_setnum (settings, optarg, atof (val)) != FLUID_OK)
{
fprintf (stderr, "Failed to set floating point parameter '%s'\n", optarg);
exit (1);
}
break;
case FLUID_INT_TYPE:
hints = fluid_settings_get_hints (settings, optarg);
if (hints & FLUID_HINT_TOGGLED)
if (fluid_settings_get_hints (settings, optarg, &hints) == FLUID_OK
&& hints & FLUID_HINT_TOGGLED)
{
if (FLUID_STRCMP (val, "yes") == 0 || FLUID_STRCMP (val, "True") == 0
|| FLUID_STRCMP (val, "TRUE") == 0 || FLUID_STRCMP (val, "true") == 0
@ -123,14 +122,14 @@ void process_o_cmd_line_option(fluid_settings_t* settings, char* optarg)
}
else ival = atoi (val);
if (!fluid_settings_setint (settings, optarg, ival))
if (fluid_settings_setint (settings, optarg, ival) != FLUID_OK)
{
fprintf (stderr, "Failed to set integer parameter '%s'\n", optarg);
exit (1);
}
break;
case FLUID_STR_TYPE:
if (!fluid_settings_setstr (settings, optarg, val))
if (fluid_settings_setstr (settings, optarg, val) != FLUID_OK)
{
fprintf (stderr, "Failed to set string parameter '%s'\n", optarg);
exit (1);
@ -184,14 +183,14 @@ settings_foreach_func (void *data, char *name, int type)
{
case FLUID_NUM_TYPE:
fluid_settings_getnum_range (settings, name, &dmin, &dmax);
ddef = fluid_settings_getnum_default (settings, name);
fluid_settings_getnum_default (settings, name, &ddef);
printf ("%-24s FLOAT [min=%0.3f, max=%0.3f, def=%0.3f]\n",
name, dmin, dmax, ddef);
break;
case FLUID_INT_TYPE:
fluid_settings_getint_range (settings, name, &imin, &imax);
idef = fluid_settings_getint_default (settings, name);
hints = fluid_settings_get_hints (settings, name);
fluid_settings_getint_default (settings, name, &idef);
fluid_settings_get_hints (settings, name, &hints);
if (!(hints & FLUID_HINT_TOGGLED))
{
@ -418,7 +417,6 @@ int main(int argc, char** argv)
fluid_settings_setint(settings, "audio.periods", atoi(optarg));
break;
case 'd':
fluid_settings_setint(settings, "synth.dump", TRUE);
dump = 1;
break;
case 'E':
@ -714,10 +712,12 @@ int main(int argc, char** argv)
if (fluid_synth_get_sfont(synth, 0) == NULL) {
/* Try to load the default soundfont if no soundfont specified */
char *s;
if (fluid_settings_getstr(settings, "synth.default-soundfont", &s) <= 0)
if (fluid_settings_dupstr(settings, "synth.default-soundfont", &s) != FLUID_OK)
s = NULL;
if ((s != NULL) && (s[0] != '\0'))
fluid_synth_sfload(synth, s, 1);
FLUID_FREE(s);
}
fluid_player_play(player);
@ -789,7 +789,7 @@ int main(int argc, char** argv)
if (interactive) {
fluid_player_stop(player);
}
if (adriver != NULL || !fluid_settings_str_equal(settings, "player.timing-source", "sample")) {
if (adriver != NULL || fluid_settings_str_equal(settings, "player.timing-source", "sample") != FLUID_OK) {
/* if no audio driver and sample timers are used, nothing makes the player advance */
fluid_player_join(player);
}

View file

@ -184,7 +184,7 @@ fluid_seq_fluidsynth_callback(unsigned int time, fluid_event_t* evt, fluid_seque
fluid_synth_pitch_bend(synth, fluid_event_get_channel(evt), fluid_event_get_pitch(evt));
break;
case FLUID_SEQ_PITCHWHHELSENS:
case FLUID_SEQ_PITCHWHEELSENS:
fluid_synth_pitch_wheel_sens(synth, fluid_event_get_channel(evt), fluid_event_get_value(evt));
break;

View file

@ -35,11 +35,15 @@ typedef enum
FLUID_CHORUS_SET_SPEED = 1 << 2,
FLUID_CHORUS_SET_DEPTH = 1 << 3,
FLUID_CHORUS_SET_TYPE = 1 << 4,
/** Value for fluid_chorus_set() which sets all chorus parameters. */
FLUID_CHORUS_SET_ALL = FLUID_CHORUS_SET_NR
| FLUID_CHORUS_SET_LEVEL
| FLUID_CHORUS_SET_SPEED
| FLUID_CHORUS_SET_DEPTH
| FLUID_CHORUS_SET_TYPE,
} fluid_chorus_set_t;
/** Value for fluid_chorus_set() which sets all chorus parameters. */
#define FLUID_CHORUS_SET_ALL 0x1F
/*
* chorus
*/

View file

@ -33,12 +33,15 @@ typedef enum
FLUID_REVMODEL_SET_ROOMSIZE = 1 << 0,
FLUID_REVMODEL_SET_DAMPING = 1 << 1,
FLUID_REVMODEL_SET_WIDTH = 1 << 2,
FLUID_REVMODEL_SET_LEVEL = 1 << 3
FLUID_REVMODEL_SET_LEVEL = 1 << 3,
/** Value for fluid_revmodel_set() which sets all reverb parameters. */
FLUID_REVMODEL_SET_ALL = FLUID_REVMODEL_SET_LEVEL
| FLUID_REVMODEL_SET_WIDTH
| FLUID_REVMODEL_SET_DAMPING
| FLUID_REVMODEL_SET_ROOMSIZE,
} fluid_revmodel_set_t;
/** Value for fluid_revmodel_set() which sets all reverb parameters. */
#define FLUID_REVMODEL_SET_ALL 0x0F
/*
* reverb preset
*/

View file

@ -108,7 +108,7 @@ int fluid_defsfont_sfont_delete(fluid_sfont_t* sfont)
return 0;
}
char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont)
const char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont)
{
return fluid_defsfont_get_name((fluid_defsfont_t*) sfont->data);
}
@ -187,7 +187,7 @@ int fluid_defpreset_preset_delete(fluid_preset_t* preset)
return 0;
}
char* fluid_defpreset_preset_get_name(fluid_preset_t* preset)
const char* fluid_defpreset_preset_get_name(fluid_preset_t* preset)
{
return fluid_defpreset_get_name((fluid_defpreset_t*) preset->data);
}
@ -538,7 +538,7 @@ int delete_fluid_defsfont(fluid_defsfont_t* sfont)
/*
* fluid_defsfont_get_name
*/
char* fluid_defsfont_get_name(fluid_defsfont_t* sfont)
const char* fluid_defsfont_get_name(fluid_defsfont_t* sfont)
{
return sfont->filename;
}
@ -778,7 +778,7 @@ fluid_defpreset_get_num(fluid_defpreset_t* preset)
return preset->num;
}
char*
const char*
fluid_defpreset_get_name(fluid_defpreset_t* preset)
{
return preset->name;

View file

@ -28,6 +28,8 @@
#include "fluidsynth.h"
#include "fluidsynth_priv.h"
#include "fluid_list.h"
#include "fluid_mod.h"
#include "fluid_gen.h"
@ -381,14 +383,14 @@ fluid_sfont_t* fluid_defsfloader_load(fluid_sfloader_t* loader, const char* file
int fluid_defsfont_sfont_delete(fluid_sfont_t* sfont);
char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont);
const char* fluid_defsfont_sfont_get_name(fluid_sfont_t* sfont);
fluid_preset_t* fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum);
void fluid_defsfont_sfont_iteration_start(fluid_sfont_t* sfont);
int fluid_defsfont_sfont_iteration_next(fluid_sfont_t* sfont, fluid_preset_t* preset);
int fluid_defpreset_preset_delete(fluid_preset_t* preset);
char* fluid_defpreset_preset_get_name(fluid_preset_t* preset);
const char* fluid_defpreset_preset_get_name(fluid_preset_t* preset);
int fluid_defpreset_preset_get_banknum(fluid_preset_t* preset);
int fluid_defpreset_preset_get_num(fluid_preset_t* preset);
int fluid_defpreset_preset_noteon(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel);
@ -419,7 +421,7 @@ struct _fluid_defsfont_t
fluid_defsfont_t* new_fluid_defsfont(fluid_settings_t* settings);
int delete_fluid_defsfont(fluid_defsfont_t* sfont);
int fluid_defsfont_load(fluid_defsfont_t* sfont, const char* file);
char* fluid_defsfont_get_name(fluid_defsfont_t* sfont);
const char* fluid_defsfont_get_name(fluid_defsfont_t* sfont);
fluid_defpreset_t* fluid_defsfont_get_preset(fluid_defsfont_t* sfont, unsigned int bank, unsigned int prenum);
void fluid_defsfont_iteration_start(fluid_defsfont_t* sfont);
int fluid_defsfont_iteration_next(fluid_defsfont_t* sfont, fluid_preset_t* preset);
@ -452,7 +454,7 @@ fluid_preset_zone_t* fluid_defpreset_get_zone(fluid_defpreset_t* preset);
fluid_preset_zone_t* fluid_defpreset_get_global_zone(fluid_defpreset_t* preset);
int fluid_defpreset_get_banknum(fluid_defpreset_t* preset);
int fluid_defpreset_get_num(fluid_defpreset_t* preset);
char* fluid_defpreset_get_name(fluid_defpreset_t* preset);
const char* fluid_defpreset_get_name(fluid_defpreset_t* preset);
int fluid_defpreset_noteon(fluid_defpreset_t* preset, fluid_synth_t* synth, int chan, int key, int vel);
/*

View file

@ -27,7 +27,7 @@
/* Prototypes */
static int fluid_ramsfont_sfont_delete(fluid_sfont_t* sfont);
static char *fluid_ramsfont_sfont_get_name(fluid_sfont_t* sfont);
static const char *fluid_ramsfont_sfont_get_name(fluid_sfont_t* sfont);
static fluid_preset_t *fluid_ramsfont_sfont_get_preset(fluid_sfont_t* sfont,
unsigned int bank,
unsigned int prenum);
@ -35,7 +35,7 @@ static void fluid_ramsfont_sfont_iteration_start(fluid_sfont_t* sfont);
static int fluid_ramsfont_sfont_iteration_next(fluid_sfont_t* sfont,
fluid_preset_t* preset);
static int fluid_rampreset_preset_delete(fluid_preset_t* preset);
static char *fluid_rampreset_preset_get_name(fluid_preset_t* preset);
static const char *fluid_rampreset_preset_get_name(fluid_preset_t* preset);
static int fluid_rampreset_preset_get_banknum(fluid_preset_t* preset);
static int fluid_rampreset_preset_get_num(fluid_preset_t* preset);
static int fluid_rampreset_preset_noteon(fluid_preset_t* preset,
@ -43,7 +43,7 @@ static int fluid_rampreset_preset_noteon(fluid_preset_t* preset,
int key, int vel);
static fluid_ramsfont_t *new_fluid_ramsfont (void);
static int delete_fluid_ramsfont (fluid_ramsfont_t* sfont);
static char *fluid_ramsfont_get_name(fluid_ramsfont_t* sfont);
static const char *fluid_ramsfont_get_name(fluid_ramsfont_t* sfont);
static int fluid_ramsfont_add_preset (fluid_ramsfont_t* sfont,
fluid_rampreset_t* preset);
static fluid_rampreset_t *fluid_ramsfont_get_preset (fluid_ramsfont_t* sfont,
@ -55,7 +55,7 @@ static fluid_rampreset_t* new_fluid_rampreset(fluid_ramsfont_t* sfont);
static int delete_fluid_rampreset (fluid_rampreset_t* preset);
static int fluid_rampreset_get_banknum (fluid_rampreset_t* preset);
static int fluid_rampreset_get_num (fluid_rampreset_t* preset);
static char *fluid_rampreset_get_name (fluid_rampreset_t* preset);
static const char *fluid_rampreset_get_name (fluid_rampreset_t* preset);
static fluid_rampreset_t *fluid_rampreset_next (fluid_rampreset_t* preset);
static int fluid_rampreset_add_zone(fluid_rampreset_t* preset,
fluid_preset_zone_t* zone);
@ -123,7 +123,7 @@ fluid_ramsfont_sfont_delete(fluid_sfont_t* sfont)
}
/* RAM SoundFont loader method to get name */
static char *
static const char *
fluid_ramsfont_sfont_get_name(fluid_sfont_t* sfont)
{
return fluid_ramsfont_get_name((fluid_ramsfont_t*) sfont->data);
@ -193,7 +193,7 @@ fluid_rampreset_preset_delete(fluid_preset_t* preset)
}
/* RAM SoundFont loader get preset name method */
static char *
static const char *
fluid_rampreset_preset_get_name(fluid_preset_t* preset)
{
return fluid_rampreset_get_name((fluid_rampreset_t*) preset->data);
@ -281,7 +281,7 @@ delete_fluid_ramsfont (fluid_ramsfont_t* sfont)
return FLUID_OK;
}
static char *
static const char *
fluid_ramsfont_get_name(fluid_ramsfont_t* sfont)
{
return sfont->name;
@ -588,7 +588,7 @@ fluid_rampreset_get_num (fluid_rampreset_t* preset)
}
/* Get a RAM SoundFont preset name */
static char *
static const char *
fluid_rampreset_get_name (fluid_rampreset_t* preset)
{
return preset->name;

View file

@ -286,7 +286,7 @@ fluid_event_pitch_bend(fluid_event_t* evt, int channel, int pitch)
void
fluid_event_pitch_wheelsens(fluid_event_t* evt, int channel, short value)
{
evt->type = FLUID_SEQ_PITCHWHHELSENS;
evt->type = FLUID_SEQ_PITCHWHEELSENS;
evt->channel = channel;
evt->value = value;
}
@ -558,7 +558,7 @@ short fluid_event_get_control(fluid_event_t* evt)
*
* The Value field is used by the following event types:
* #FLUID_SEQ_PROGRAMCHANGE, #FLUID_SEQ_PROGRAMSELECT (preset_num),
* #FLUID_SEQ_PITCHWHHELSENS, #FLUID_SEQ_MODULATION, #FLUID_SEQ_SUSTAIN,
* #FLUID_SEQ_PITCHWHEELSENS, #FLUID_SEQ_MODULATION, #FLUID_SEQ_SUSTAIN,
* #FLUID_SEQ_CONTROLCHANGE, #FLUID_SEQ_PAN, #FLUID_SEQ_VOLUME,
* #FLUID_SEQ_REVERBSEND, #FLUID_SEQ_CHORUSSEND.
*/

View file

@ -92,7 +92,7 @@ fluid_gen_info_t fluid_gen_info[] = {
/**
* Set an array of generators to their default values.
* @param gen Array of generators (should be #GEN_LAST in size).
* @return Always returns 0
* @return Always returns #FLUID_OK
*/
int
fluid_gen_set_default_values(fluid_gen_t* gen)

View file

@ -33,12 +33,34 @@ typedef struct _fluid_gen_info_t {
float def; /* The default value (cfr. fluid_gen_set_default_values()) */
} fluid_gen_info_t;
/**
* SoundFont generator structure.
*/
typedef struct _fluid_gen_t
{
unsigned char flags; /**< Is the generator set or not (#fluid_gen_flags) */
double val; /**< The nominal value */
double mod; /**< Change by modulators */
double nrpn; /**< Change by NRPN messages */
} fluid_gen_t;
/**
* Enum value for 'flags' field of #fluid_gen_t (not really flags).
*/
enum fluid_gen_flags
{
GEN_UNUSED, /**< Generator value is not set */
GEN_SET, /**< Generator value is set */
GEN_ABS_NRPN /**< Generator is an absolute value */
};
#define fluid_gen_set_mod(_gen, _val) { (_gen)->mod = (double) (_val); }
#define fluid_gen_set_nrpn(_gen, _val) { (_gen)->nrpn = (double) (_val); }
fluid_real_t fluid_gen_scale(int gen, float value);
fluid_real_t fluid_gen_scale_nrpn(int gen, int nrpn);
int fluid_gen_init(fluid_gen_t* gen, fluid_channel_t* channel);
int fluid_gen_set_default_values(fluid_gen_t* gen);
#endif /* _FLUID_GEN_H */

View file

@ -22,8 +22,11 @@
#include "fluid_chan.h"
#include "fluid_voice.h"
/*
* fluid_mod_clone
/**
* Clone the modulators destination, sources, flags and amount.
* @param mod the modulator to store the copy to
* @param src the source modulator to retrieve the information from
* @note The \c next member of \c mod will be left unchanged.
*/
void
fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src)
@ -418,7 +421,43 @@ fluid_mod_test_identity (fluid_mod_t *mod1, fluid_mod_t *mod2)
&& mod1->flags2 == mod2->flags2;
}
/**
* Check if the modulator has the given source.
*
* @param cc Boolean value indicating if ctrl is a CC controller or not
* @param ctrl The source to check for (if \c cc == FALSE : a value of type #fluid_mod_src, else the value of the MIDI CC to check for)
*
* @return TRUE if the modulator has the given source, FALSE otherwise.
*/
int fluid_mod_has_source(fluid_mod_t * mod, int cc, int ctrl)
{
return
(
(
((mod->src1 == ctrl) && ((mod->flags1 & FLUID_MOD_CC) != 0) && (cc != 0))
|| ((mod->src1 == ctrl) && ((mod->flags1 & FLUID_MOD_CC) == 0) && (cc == 0))
)
||
(
((mod->src2 == ctrl) && ((mod->flags2 & FLUID_MOD_CC) != 0) && (cc != 0))
|| ((mod->src2 == ctrl) && ((mod->flags2 & FLUID_MOD_CC) == 0) && (cc == 0))
)
);
}
/**
* Check if the modulator has the given destination.
* @param gen The destination generator of type #fluid_gen_type to check for
* @return TRUE if the modulator has the given destination, FALSE otherwise.
*/
int fluid_mod_has_dest(fluid_mod_t * mod, int gen)
{
return mod->dest == gen;
}
/* debug function: Prints the contents of a modulator */
#ifdef DEBUG
void fluid_dump_modulator(fluid_mod_t * mod){
int src1=mod->src1;
int dest=mod->dest;
@ -467,5 +506,5 @@ void fluid_dump_modulator(fluid_mod_t * mod){
}; /* switch dest */
printf(", amount %f flags %i src2 %i flags2 %i\n",amount, flags1, src2, flags2);
};
#endif

View file

@ -24,17 +24,30 @@
#include "fluidsynth_priv.h"
#include "fluid_conv.h"
void fluid_mod_clone(fluid_mod_t* mod, fluid_mod_t* src);
/**
* Modulator structure. See SoundFont 2.04 PDF section 8.2.
*/
struct _fluid_mod_t
{
unsigned char dest; /**< Destination generator to control */
unsigned char src1; /**< Source controller 1 */
unsigned char flags1; /**< Source controller 1 flags */
unsigned char src2; /**< Source controller 2 */
unsigned char flags2; /**< Source controller 2 flags */
double amount; /**< Multiplier amount */
/* The 'next' field allows to link modulators into a list. It is
* not used in fluid_voice.c, there each voice allocates memory for a
* fixed number of modulators. Since there may be a huge number of
* different zones, this is more efficient.
*/
fluid_mod_t * next;
};
fluid_real_t fluid_mod_get_value(fluid_mod_t* mod, fluid_channel_t* chan, fluid_voice_t* voice);
#ifdef DEBUG
void fluid_dump_modulator(fluid_mod_t * mod);
#define fluid_mod_has_source(mod,cc,ctrl) \
( ((((mod)->src1 == ctrl) && (((mod)->flags1 & FLUID_MOD_CC) != 0) && (cc != 0)) \
|| ((((mod)->src1 == ctrl) && (((mod)->flags1 & FLUID_MOD_CC) == 0) && (cc == 0)))) \
|| ((((mod)->src2 == ctrl) && (((mod)->flags2 & FLUID_MOD_CC) != 0) && (cc != 0)) \
|| ((((mod)->src2 == ctrl) && (((mod)->flags2 & FLUID_MOD_CC) == 0) && (cc == 0)))))
#define fluid_mod_has_dest(mod,gen) ((mod)->dest == gen)
#endif
#endif /* _FLUID_MOD_H */

View file

@ -175,8 +175,6 @@ void fluid_synth_settings(fluid_settings_t* settings)
{
fluid_settings_register_int(settings, "synth.verbose", 0, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.dump", 0, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.reverb.active", 1, 0, 1,
FLUID_HINT_TOGGLED, NULL, NULL);
fluid_settings_register_int(settings, "synth.chorus.active", 1, 0, 1,
@ -601,7 +599,6 @@ new_fluid_synth(fluid_settings_t *settings)
fluid_settings_getint(settings, "synth.reverb.active", &synth->with_reverb);
fluid_settings_getint(settings, "synth.chorus.active", &synth->with_chorus);
fluid_settings_getint(settings, "synth.verbose", &synth->verbose);
fluid_settings_getint(settings, "synth.dump", &synth->dump);
fluid_settings_getint(settings, "synth.polyphony", &synth->polyphony);
fluid_settings_getnum(settings, "synth.sample-rate", &synth->sample_rate);
@ -770,13 +767,13 @@ new_fluid_synth(fluid_settings_t *settings)
}
synth->bank_select = FLUID_BANK_STYLE_GS;
if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gm") == 1)
if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gm"))
synth->bank_select = FLUID_BANK_STYLE_GM;
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gs") == 1)
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "gs"))
synth->bank_select = FLUID_BANK_STYLE_GS;
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "xg") == 1)
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "xg"))
synth->bank_select = FLUID_BANK_STYLE_XG;
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "mma") == 1)
else if (fluid_settings_str_equal (settings, "synth.midi-bank-select", "mma"))
synth->bank_select = FLUID_BANK_STYLE_MMA;
fluid_synth_process_event_queue(synth);
@ -2124,7 +2121,7 @@ fluid_synth_sfont_select(fluid_synth_t* synth, int chan, unsigned int sfont_id)
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
* @since 1.1.1
*
* Note: Channel retains its SoundFont ID and bank numbers, while the program
* @note Channel retains its SoundFont ID and bank numbers, while the program
* number is set to an "unset" state. MIDI program changes may re-assign a
* preset if one matches.
*/
@ -2138,36 +2135,6 @@ fluid_synth_unset_program (fluid_synth_t *synth, int chan)
FLUID_API_RETURN(result);
}
/**
* Get current SoundFont ID, bank number and program number for a MIDI channel.
* @param synth FluidSynth instance
* @param chan MIDI channel number (0 to MIDI channel count - 1)
* @param sfont_id Location to store SoundFont ID
* @param bank_num Location to store MIDI bank number
* @param preset_num Location to store MIDI program number
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id,
unsigned int* bank_num, unsigned int* preset_num)
{
fluid_channel_t* channel;
fluid_return_val_if_fail (sfont_id != NULL, FLUID_FAILED);
fluid_return_val_if_fail (bank_num != NULL, FLUID_FAILED);
fluid_return_val_if_fail (preset_num != NULL, FLUID_FAILED);
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
channel = synth->channel[chan];
fluid_channel_get_sfont_bank_prog(channel, (int *)sfont_id, (int *)bank_num,
(int *)preset_num);
/* 128 indicates that the preset is unset. Set to 0 to be backwards compatible. */
if (*preset_num == FLUID_UNSET_PROGRAM) *preset_num = 0;
FLUID_API_RETURN(FLUID_OK);
}
/**
* Select an instrument on a MIDI channel by SoundFont ID, bank and program numbers.
* @param synth FluidSynth instance
@ -2450,7 +2417,7 @@ fluid_synth_get_polyphony(fluid_synth_t* synth)
* @return Number of currently active voices.
* @since 1.1.0
*
* Note: To generate accurate continuous statistics of the voice count, caller
* @note To generate accurate continuous statistics of the voice count, caller
* should ensure this function is called synchronously with the audio synthesis
* process. This can be done in the new_fluid_audio_driver2() audio callback
* function for example.
@ -3688,78 +3655,28 @@ fluid_synth_get_sfont_by_name(fluid_synth_t* synth, const char *name)
}
/**
* Get active preset on a MIDI channel.
* @param synth FluidSynth instance
* @param chan MIDI channel number (0 to MIDI channel count - 1)
* @return Preset or NULL if no preset active on channel
* @deprecated fluid_synth_get_channel_info() should replace most use cases.
*
* @note Should only be called from within synthesis thread, which includes
* SoundFont loader preset noteon methods. Not thread safe otherwise.
*/
fluid_preset_t *
fluid_synth_get_channel_preset(fluid_synth_t* synth, int chan)
{
fluid_preset_t* result;
fluid_channel_t *channel;
FLUID_API_ENTRY_CHAN(NULL);
channel = synth->channel[chan];
result = channel->preset;
fluid_synth_api_exit(synth);
return result;
}
/**
* Get information on the currently selected preset on a MIDI channel.
* Get information about a MIDI channel. Specifically retrieve the currently active fluid_preset_t, SoundFont ID, bank number and program number for that MIDI channel.
* @param synth FluidSynth instance
* @param chan MIDI channel number (0 to MIDI channel count - 1)
* @param info Caller supplied structure to fill with preset information
* @return #FLUID_OK on success, #FLUID_FAILED otherwise
* @since 1.1.1
*
* @note The ID, bank and program assigned to the MIDI channel may be different to the ID, bank and program specified by the preset. This may happen if e.g. a preset requested by a program change could not be found and the synth falls back to a default preset instead.
*/
int
fluid_synth_get_channel_info (fluid_synth_t *synth, int chan,
fluid_synth_channel_info_t *info)
{
fluid_channel_t *channel;
fluid_preset_t *preset;
char *name;
if (info)
{
info->assigned = FALSE;
info->name[0] = '\0';
}
fluid_return_val_if_fail (info != NULL, FLUID_FAILED);
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
channel = synth->channel[chan];
preset = channel->preset;
if (preset)
{
info->assigned = TRUE;
name = fluid_preset_get_name (preset);
if (name)
{
strncpy (info->name, name, FLUID_SYNTH_CHANNEL_INFO_NAME_SIZE);
info->name[FLUID_SYNTH_CHANNEL_INFO_NAME_SIZE - 1] = '\0';
}
else info->name[0] = '\0';
info->sfont_id = preset->sfont->id;
info->bank = fluid_preset_get_banknum (preset);
info->program = fluid_preset_get_num (preset);
}
else
{
info->assigned = FALSE;
fluid_channel_get_sfont_bank_prog (channel, &info->sfont_id, &info->bank, &info->program);
info->name[0] = '\0';
}
info->preset = channel->preset;
fluid_channel_get_sfont_bank_prog (channel, &info->sfont_id, &info->bank, &info->program);
fluid_synth_api_exit(synth);
return FLUID_OK;
@ -4797,124 +4714,40 @@ fluid_synth_get_settings(fluid_synth_t* synth)
return synth->settings;
}
/**
* Convenience function to set a string setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param str Value to assign to the setting
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setstr(fluid_synth_t* synth, const char* name, const char* str)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
return fluid_settings_setstr(synth->settings, name, str);
}
/**
* Convenience function to duplicate a string setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param str Location to store a pointer to the newly allocated string value
* @return FLUID_OK on success, FLUID_FAILED otherwise
*
* The returned string is owned by the caller and should be freed with free()
* when finished with it.
*/
int
fluid_synth_dupstr(fluid_synth_t* synth, const char* name, char** str)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
fluid_return_val_if_fail (str != NULL, FLUID_FAILED);
return fluid_settings_dupstr(synth->settings, name, str);
}
/**
* Convenience function to set a floating point setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param val Value to assign to the setting
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setnum(fluid_synth_t* synth, const char* name, double val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
return fluid_settings_setnum(synth->settings, name, val);
}
/**
* Convenience function to get a floating point setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param val Location to store the current value of the setting
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_getnum(fluid_synth_t* synth, const char* name, double* val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
return fluid_settings_getnum(synth->settings, name, val);
}
/**
* Convenience function to set an integer setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param val Value to assign to the setting
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_setint(fluid_synth_t* synth, const char* name, int val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
return fluid_settings_setint(synth->settings, name, val);
}
/**
* Convenience function to get an integer setting of a synth.
* @param synth FluidSynth instance
* @param name Name of setting parameter
* @param val Location to store the current value of the setting
* @return FLUID_OK on success, FLUID_FAILED otherwise
*/
int
fluid_synth_getint(fluid_synth_t* synth, const char* name, int* val)
{
fluid_return_val_if_fail (synth != NULL, FLUID_FAILED);
fluid_return_val_if_fail (name != NULL, FLUID_FAILED);
return fluid_settings_getint(synth->settings, name, val);
}
/**
* Set a SoundFont generator (effect) value on a MIDI channel in real-time.
* @param synth FluidSynth instance
* @param chan MIDI channel number (0 to MIDI channel count - 1)
* @param param SoundFont generator ID (#fluid_gen_type)
* @param value Offset generator value to assign to the MIDI channel
* @param value Offset or absolute generator value to assign to the MIDI channel
* @param absolute FALSE to assign a relative value, TRUE to assign an absolute value
* @param normalized FALSE if value is specified in the native units of the generator,
* TRUE to take the value as a 0.0-1.0 range and apply it to the valid
* generator effect range (scaled and shifted as necessary).
* @return FLUID_OK on success, FLUID_FAILED otherwise
* @since @NEXT_RELEASE@
*
* Parameter numbers and ranges are described in the SoundFont 2.01
* specification PDF, paragraph 8.1.3, page 48. See #fluid_gen_type.
* This function allows for setting all effect parameters in real time on a
* MIDI channel. Setting absolute to non-zero will cause the value to override
* any generator values set in the instruments played on the MIDI channel.
* See SoundFont 2.01 spec, paragraph 8.1.3, page 48 for details on SoundFont
* generator parameters and valid ranges.
*
* @note The old behaviour of fluid_synth_set_gen() assumed \c absolute and \c normalized to
* be FALSE.
*/
int
fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param, float value)
fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param,
float value, int absolute, int normalized)
{
float v;
fluid_return_val_if_fail (param >= 0 && param < GEN_LAST, FLUID_FAILED);
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
fluid_synth_set_gen_LOCAL (synth, chan, param, value, FALSE);
v = normalized ? fluid_gen_scale(param, value) : value;
fluid_synth_set_gen_LOCAL (synth, chan, param, v, absolute);
FLUID_API_RETURN(FLUID_OK);
}
@ -4937,40 +4770,6 @@ fluid_synth_set_gen_LOCAL (fluid_synth_t* synth, int chan, int param, float valu
}
}
/**
* Set a SoundFont generator (effect) value on a MIDI channel in real-time.
* @param synth FluidSynth instance
* @param chan MIDI channel number (0 to MIDI channel count - 1)
* @param param SoundFont generator ID (#fluid_gen_type)
* @param value Offset or absolute generator value to assign to the MIDI channel
* @param absolute 0 to assign a relative value, non-zero to assign an absolute value
* @param normalized 0 if value is specified in the native units of the generator,
* non-zero to take the value as a 0.0-1.0 range and apply it to the valid
* generator effect range (scaled and shifted as necessary).
* @return FLUID_OK on success, FLUID_FAILED otherwise
* @since 1.1.0
*
* This function allows for setting all effect parameters in real time on a
* MIDI channel. Setting absolute to non-zero will cause the value to override
* any generator values set in the instruments played on the MIDI channel.
* See SoundFont 2.01 spec, paragraph 8.1.3, page 48 for details on SoundFont
* generator parameters and valid ranges.
*/
int
fluid_synth_set_gen2(fluid_synth_t* synth, int chan, int param,
float value, int absolute, int normalized)
{
float v;
fluid_return_val_if_fail (param >= 0 && param < GEN_LAST, FLUID_FAILED);
FLUID_API_ENTRY_CHAN(FLUID_FAILED);
v = normalized ? fluid_gen_scale(param, value) : value;
fluid_synth_set_gen_LOCAL (synth, chan, param, v, absolute);
FLUID_API_RETURN(FLUID_OK);
}
/**
* Get generator value assigned to a MIDI channel.
* @param synth FluidSynth instance
@ -5213,7 +5012,6 @@ void fluid_synth_api_exit(fluid_synth_t* synth)
}
/**
* Set midi channel type
* @param synth FluidSynth instance

View file

@ -116,7 +116,6 @@ struct _fluid_synth_t
int with_reverb; /**< Should the synth use the built-in reverb unit? */
int with_chorus; /**< Should the synth use the built-in chorus unit? */
int verbose; /**< Turn verbose mode on? */
int dump; /**< Dump events to stdout to hook up a user interface? */
double sample_rate; /**< The sample rate */
int midi_channels; /**< the number of MIDI channels (>= 16) */
int bank_select; /**< the style of Bank Select MIDI messages */
@ -174,13 +173,6 @@ struct _fluid_synth_t
#endif
};
int fluid_synth_setstr(fluid_synth_t* synth, const char* name, const char* str);
int fluid_synth_dupstr(fluid_synth_t* synth, const char* name, char** str);
int fluid_synth_setnum(fluid_synth_t* synth, const char* name, double val);
int fluid_synth_getnum(fluid_synth_t* synth, const char* name, double* val);
int fluid_synth_setint(fluid_synth_t* synth, const char* name, int val);
int fluid_synth_getint(fluid_synth_t* synth, const char* name, int* val);
fluid_preset_t* fluid_synth_find_preset(fluid_synth_t* synth,
unsigned int banknum,
unsigned int prognum);

View file

@ -1,3 +0,0 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = fluidsynth.mcp README.txt

View file

@ -1,20 +0,0 @@
FluidSynth MacOS9 port
----------------------
Antoine Schmitt March 2003
1) Configuring
As Macintosh cannot run the configure shell command, you need to do it yourself. Mainly, this consists in:
- creating the include/fluidsynth/version.h file by hand, using the version.h.in file as a template, and defining the VERSION* defines by hand, using the values from the 'configure.ac' file.
Example:
#define FLUIDSYNTH_VERSION "1.0.0"
#define FLUIDSYNTH_VERSION_MAJOR 1
#define FLUIDSYNTH_VERSION_MINOR 0
#define FLUIDSYNTH_VERSION_MICRO 0
2) src/config_macos.h file
In this file, you can define which audio driver to use. Only the SoundManager driver has been tested (SNDMAN_SUPPORT). You can choose the PORTAUDIO driver.
3) Compiler, etc..
This project has been compiled with CodeWarrior 4.0 on MacOS9.2.2

Binary file not shown.

View file

@ -1,4 +0,0 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = fluidsynth fluidsynth_dll fluidsynth_lib
EXTRA_DIST = fluidsynth.dsw fluidsynth.sln

View file

@ -1,3 +0,0 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = fluidsynth.dsp fluidsynth.vcproj

View file

@ -1,3 +0,0 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = fluidsynth_dll.dsp fluidsynth_dll.vcproj

View file

@ -1,3 +0,0 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = fluidsynth_lib.dsp fluidsynth_lib.vcproj

File diff suppressed because it is too large Load diff

View file

@ -22,35 +22,26 @@
#ifndef _FLUID_SETTINGS_H
#define _FLUID_SETTINGS_H
/** returns 1 if the option was added, 0 otherwise */
int fluid_settings_add_option(fluid_settings_t* settings, const char* name, const char* s);
/** returns 1 if the option was added, 0 otherwise */
int fluid_settings_remove_option(fluid_settings_t* settings, const char* name, const char* s);
typedef int (*fluid_num_update_t)(void* data, const char* name, double value);
typedef int (*fluid_str_update_t)(void* data, const char* name, const char* value);
typedef int (*fluid_int_update_t)(void* data, const char* name, int value);
/** returns 0 if the value has been registered correctly, non-zero
otherwise */
int fluid_settings_register_str(fluid_settings_t* settings, const char* name, const char* def, int hints,
fluid_str_update_t fun, void* data);
fluid_str_update_t fun, void* data);
typedef int (*fluid_num_update_t)(void* data, const char* name, double value);
/** returns 0 if the value has been registered correctly, non-zero
otherwise */
int fluid_settings_register_num(fluid_settings_t* settings, const char* name, double def,
double min, double max, int hints,
fluid_num_update_t fun, void* data);
/** returns 0 if the value has been registered correctly, non-zero
otherwise */
typedef int (*fluid_int_update_t)(void* data, const char* name, int value);
int fluid_settings_register_int(fluid_settings_t* settings, const char* name, int def,
int min, int max, int hints,
fluid_int_update_t fun, void* data);
#endif /* _FLUID_SETTINGS_H */