Overhauled MIDI router and added public API for creating and adding rules.

Updated synth.audio-channels and synth.audio-groups to reflect actual maximum value of 128.
Re-enabled aufile-support argument in configure.ac to make it possible to disable audio output driver.
Updates to doc/Doxyfile to exclude private header files.
Lots of updates to doc/fluidsynth-v11-devdoc.txt: Removed some information that seemed irrelavent to the topic at hand, added descriptions of all FluidSynth settings and sorted, re-wrote MIDI router information and added example code, and more.
Removed src/config.h.in from svn.
This commit is contained in:
Josh Green 2009-10-22 07:06:26 +00:00
parent 9ea9f60494
commit f3b62ad39a
9 changed files with 1670 additions and 1127 deletions

View file

@ -191,16 +191,16 @@ dnl
dnl - Sound file support check
dnl AUFILE_SUPPORT=0
dnl
dnl AC_ARG_ENABLE(aufile-support,
dnl [ --disable-aufile-support Do not compile support for sound file output],
dnl enable_aufile_support=no)
dnl
dnl if test "x${enable_aufile_support}" != "xno"; then
dnl AUFILE_SUPPORT=1
dnl AC_DEFINE(AUFILE_SUPPORT, 1, [Define to activate sound output to files])
dnl fi
AUFILE_SUPPORT=0
AC_ARG_ENABLE(aufile-support,
[ --disable-aufile-support Do not compile support for sound file output],
enable_aufile_support=no)
if test "x${enable_aufile_support}" != "xno"; then
AUFILE_SUPPORT=1
AC_DEFINE(AUFILE_SUPPORT, 1, [Define to activate sound output to files])
fi
dnl - Check for PulseAudio support
@ -532,11 +532,11 @@ else
echo "OS/2 DART support: no"
fi
dnl if test "${AUFILE_SUPPORT}" = "1"; then
dnl echo "Sound file: yes"
dnl else
dnl echo "Sound file: no"
dnl fi
if test "${AUFILE_SUPPORT}" = "1"; then
echo "Audio to file driver: yes"
else
echo "Audio to file driver: no"
fi
if test "$WITH_READLINE" = "1"; then
echo "Readline: yes (NOTE: GPL library)"

View file

@ -31,7 +31,6 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
@ -52,7 +51,7 @@ TYPEDEF_HIDES_STRUCT = NO
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = NO
EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
@ -98,7 +97,7 @@ INPUT = fluidsynth-v11-devdoc.txt \
../include/fluidsynth \
../src
INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.[ch]
FILE_PATTERNS = *.c *.h
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
@ -121,7 +120,7 @@ REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------

File diff suppressed because it is too large Load diff

View file

@ -52,6 +52,20 @@ FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t* evt, int val);
FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t* evt, void *data,
int size, int dynamic);
/**
* MIDI router rule type.
*/
typedef enum
{
FLUID_MIDI_ROUTER_RULE_NOTE, /**< MIDI note rule */
FLUID_MIDI_ROUTER_RULE_CC, /**< MIDI controller rule */
FLUID_MIDI_ROUTER_RULE_PROG_CHANGE, /**< MIDI program change rule */
FLUID_MIDI_ROUTER_RULE_PITCH_BEND, /**< MIDI pitch bend rule */
FLUID_MIDI_ROUTER_RULE_CHANNEL_PRESSURE, /**< MIDI channel pressure rule */
FLUID_MIDI_ROUTER_RULE_KEY_PRESSURE, /**< MIDI key pressure rule */
FLUID_MIDI_ROUTER_RULE_COUNT /**< Total count of rule types */
} fluid_midi_router_rule_type;
/**
* Generic callback function for MIDI events.
* @param data User defined data pointer
@ -70,6 +84,18 @@ FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* sett
handle_midi_event_func_t handler,
void* event_handler_data);
FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler);
FLUIDSYNTH_API int fluid_midi_router_set_default_rules (fluid_midi_router_t *router);
FLUIDSYNTH_API int fluid_midi_router_clear_rules (fluid_midi_router_t *router);
FLUIDSYNTH_API int fluid_midi_router_add_rule (fluid_midi_router_t *router,
fluid_midi_router_rule_t *rule, int type);
FLUIDSYNTH_API fluid_midi_router_rule_t *new_fluid_midi_router_rule (void);
FLUIDSYNTH_API void delete_fluid_midi_router_rule (fluid_midi_router_rule_t *rule);
FLUIDSYNTH_API void fluid_midi_router_rule_set_chan (fluid_midi_router_rule_t *rule,
int min, int max, float mul, int add);
FLUIDSYNTH_API void fluid_midi_router_rule_set_param1 (fluid_midi_router_rule_t *rule,
int min, int max, float mul, int add);
FLUIDSYNTH_API void fluid_midi_router_rule_set_param2 (fluid_midi_router_rule_t *rule,
int min, int max, float mul, int add);
FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void* data, fluid_midi_event_t* event);
FLUIDSYNTH_API int fluid_midi_dump_prerouter(void* data, fluid_midi_event_t* event);
FLUIDSYNTH_API int fluid_midi_dump_postrouter(void* data, fluid_midi_event_t* event);

View file

@ -29,7 +29,7 @@ extern "C" {
/**
* @file seqbind.h
* @brief FIXME Not sure why this is separate from seq.h.
* @brief Functions for binding sequencer objects to other subsystems.
*/
FLUIDSYNTH_API

View file

@ -1,218 +0,0 @@
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Define to enable ALSA driver */
#undef ALSA_SUPPORT
/* whether or not we are supporting CoreAudio */
#undef COREAUDIO_SUPPORT
/* whether or not we are supporting CoreMIDI */
#undef COREMIDI_SUPPORT
/* whether or not we are supporting DART */
#undef DART_SUPPORT
/* Define if building for Mac OS X Darwin */
#undef DARWIN
/* Define to activate debugging message */
#undef DEBUG
/* Define to enable FPE checks */
#undef FPE_CHECK
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* whether or not we are supporting ladcca */
#undef HAVE_LADCCA
/* whether or not we are supporting lash */
#undef HAVE_LASH
/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL
/* Define to 1 if you have the `MidiShare' library (-lMidiShare). */
#undef HAVE_LIBMIDISHARE
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <machine/soundcard.h> header file. */
#undef HAVE_MACHINE_SOUNDCARD_H
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <MidiShare.h> header file. */
#undef HAVE_MIDISHARE_H
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#undef HAVE_NETINET_TCP_H
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/soundcard.h> header file. */
#undef HAVE_SYS_SOUNDCARD_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
/* Define to enable JACK driver */
#undef JACK_SUPPORT
/* Include the LADSPA Fx unit */
#undef LADSPA
/* libsndfile has ogg vorbis support */
#undef LIBSNDFILE_HASVORBIS
/* Define to enable libsndfile support */
#undef LIBSNDFILE_SUPPORT
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to enable MidiShare driver */
#undef MIDISHARE_SUPPORT
/* Define if using the MinGW32 environment */
#undef MINGW32
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to enable OSS driver */
#undef OSS_SUPPORT
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to enable PortAudio driver */
#undef PORTAUDIO_SUPPORT
/* Define to enable PulseAudio driver */
#undef PULSE_SUPPORT
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to enable SIGFPE assertions */
#undef TRAP_ON_FPE
/* Version number of package */
#undef VERSION
/* Define to do all DSP in single floating point precision */
#undef WITH_FLOAT
/* Define to profile the DSP code */
#undef WITH_PROFILING
/* Define to use the readline library for line editing */
#undef WITH_READLINE
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif

File diff suppressed because it is too large Load diff

View file

@ -28,11 +28,6 @@
#include "fluid_midi.h"
#include "fluid_sys.h"
void fluid_midi_router_destroy_all_rules(fluid_midi_router_t* router);
fluid_midi_router_rule_t* new_fluid_midi_router_rule(void);
int fluid_midi_router_handle_clear(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out);
int fluid_midi_router_handle_default(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out);
int fluid_midi_router_handle_begin(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out);
@ -41,72 +36,4 @@ int fluid_midi_router_handle_par1(fluid_synth_t* synth, int ac, char** av, fluid
int fluid_midi_router_handle_par2(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out);
int fluid_midi_router_handle_end(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out);
int fluid_midi_router_begin(fluid_midi_router_t* router, fluid_midi_router_rule_t** dest);
int fluid_midi_router_end(fluid_midi_router_t* router);
int fluid_midi_router_create_default_rules(fluid_midi_router_t* router);
void fluid_midi_router_disable_all_rules(fluid_midi_router_t* router);
void fluid_midi_router_free_unused_rules(fluid_midi_router_t* router);
/*
* fluid_midi_router
*/
struct _fluid_midi_router_t {
fluid_synth_t* synth;
fluid_midi_router_rule_t* note_rules;
fluid_midi_router_rule_t* cc_rules;
fluid_midi_router_rule_t* progchange_rules;
fluid_midi_router_rule_t* pitchbend_rules;
fluid_midi_router_rule_t* channel_pressure_rules;
fluid_midi_router_rule_t* key_pressure_rules;
int new_rule_chan_min;
int new_rule_chan_max;
double new_rule_chan_mul;
int new_rule_chan_add;
int new_rule_par1_min;
int new_rule_par1_max;
double new_rule_par1_mul;
int new_rule_par1_add;
int new_rule_par2_min;
int new_rule_par2_max;
double new_rule_par2_mul;
int new_rule_par2_add;
fluid_midi_router_rule_t** dest;
handle_midi_event_func_t event_handler; /* Callback function for generated events */
void* event_handler_data; /* One arg for the callback */
int nr_midi_channels; /* For clipping the midi channel */
fluid_mutex_t ruletables_mutex;
};
struct _fluid_midi_router_rule_t {
int chan_min; /* Channel window, for which this rule is valid */
int chan_max;
fluid_real_t chan_mul; /* Channel multiplier (usually 0 or 1) */
int chan_add; /* Channel offset */
int par1_min; /* Parameter 1 window, for which this rule is valid */
int par1_max;
fluid_real_t par1_mul;
int par1_add;
int par2_min; /* Parameter 2 window, for which this rule is valid */
int par2_max;
fluid_real_t par2_mul;
int par2_add;
int pending_events; /* In case of noteon: How many keys are still down? */
char keys_cc[128]; /* Flags, whether a key is down / controller is set (sustain) */
fluid_midi_router_rule_t* next; /* next entry */
int state; /* Does this rule expire, as soon as (for example) all keys are up? */
};
enum fluid_midirule_state {
MIDIRULE_ACTIVE = 0x00,
MIDIRULE_WAITING,
MIDIRULE_DONE
};
#endif

View file

@ -227,9 +227,9 @@ void fluid_synth_settings(fluid_settings_t* settings)
0.2f, 0.0f, 10.0f,
0, NULL, NULL);
fluid_settings_register_int(settings, "synth.audio-channels",
1, 1, 256, 0, NULL, NULL);
1, 1, 128, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.audio-groups",
1, 1, 256, 0, NULL, NULL);
1, 1, 128, 0, NULL, NULL);
fluid_settings_register_int(settings, "synth.effects-channels",
2, 2, 2, 0, NULL, NULL);
fluid_settings_register_num(settings, "synth.sample-rate",
@ -4613,7 +4613,7 @@ fluid_synth_count_midi_channels(fluid_synth_t* synth)
/**
* Get the total count of audio channels.
* @param synth FluidSynth instance
* @return Count of audio channels
* @return Count of audio channel stereo pairs (1 = 2 channels, 2 = 4, etc)
*/
int
fluid_synth_count_audio_channels(fluid_synth_t* synth)
@ -4625,10 +4625,10 @@ fluid_synth_count_audio_channels(fluid_synth_t* synth)
/**
* Get the total number of allocated audio channels. Usually identical to the
* number of audio channels.
* number of audio channels. Can be employed by LADSPA effects subsystem.
*
* @param synth FluidSynth instance
* @return Count of allocated audio channels
* @return Count of audio group stereo pairs (1 = 2 channels, 2 = 4, etc)
*/
int
fluid_synth_count_audio_groups(fluid_synth_t* synth)