updated fluidsynth to 1.0.8

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24454 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2008-03-18 22:17:50 +00:00
parent a529aaf3c6
commit 5c102180bd
71 changed files with 4114 additions and 4125 deletions
+31 -34
View File
@@ -44,40 +44,37 @@ extern "C" {
#endif
/**
\file fluidsynth.h
\brief fluidsynth is a real-time SoundFont(R) synthesizer. This is
the header of the fluidsynth library and contains the
synthesizer's public API.
Depending on how you want to use or extend the synthesizer you
will need different API functions. You probably do not need all
of them. Here is what you might want to do:
o Embedded synthesizer: create a new synthesizer and send MIDI
events to it. The sound goes directly to the audio output of
your system.
o Plugin synthesizer: create a synthesizer and send MIDI events
but pull the audio back into your application.
o SoundFont plugin: create a new type of "SoundFont" and allow
the synthesizer to load your type of SoundFonts.
o MIDI input: Create a MIDI handler to read the MIDI input on your
machine and send the MIDI events directly to the synthesizer.
o MIDI files: Open MIDI files and send the MIDI events to the
synthesizer.
o Command lines: You can send textual commands to the synthesizer.
SoundFont(R) is a registered trademark of E-mu Systems, Inc.
*/
/**
* @file fluidsynth.h
* @brief FluidSynth is a real-time synthesizer designed for SoundFont(R) files.
*
* This is the header of the fluidsynth library and contains the
* synthesizer's public API.
*
* Depending on how you want to use or extend the synthesizer you
* will need different API functions. You probably do not need all
* of them. Here is what you might want to do:
*
* o Embedded synthesizer: create a new synthesizer and send MIDI
* events to it. The sound goes directly to the audio output of
* your system.
*
* o Plugin synthesizer: create a synthesizer and send MIDI events
* but pull the audio back into your application.
*
* o SoundFont plugin: create a new type of "SoundFont" and allow
* the synthesizer to load your type of SoundFonts.
*
* o MIDI input: Create a MIDI handler to read the MIDI input on your
* machine and send the MIDI events directly to the synthesizer.
*
* o MIDI files: Open MIDI files and send the MIDI events to the
* synthesizer.
*
* o Command lines: You can send textual commands to the synthesizer.
*
* SoundFont(R) is a registered trademark of E-mu Systems, Inc.
*/
#include "fluidsynth/types.h"
#include "fluidsynth/settings.h"
+22 -8
View File
@@ -25,15 +25,29 @@
extern "C" {
#endif
/**
* @file audio.h
* @brief Functions for audio driver output.
*
* Defines functions for creating audio driver output. Use
* new_fluid_audio_driver() to create a new audio driver for a given synth
* and configuration settings. The function new_fluid_audio_driver2() can be
* used if custom audio processing is desired before the audio is sent to the
* audio driver (although it is not as efficient).
*/
/** Audio driver
*
*
*/
/** The function should return non-zero if an error occured. */
/**
* Callback function type used with new_fluid_audio_driver2() to allow for
* custom user audio processing before the audio is sent to the driver. This
* function is responsible for rendering the audio to the buffers.
* @param data The user data parameter as passed to new_fluid_audio_driver2().
* @param len Length of the audio in frames.
* @param nin Count of buffers in 'in'
* @param in FIXME - Not used currently?
* @param nout Count of arrays in 'out' (i.e., channel count)
* @param out Output buffers, one for each channel
* @return Should return 0 on success, non-zero if an error occured.
*/
typedef int (*fluid_audio_func_t)(void* data, int len,
int nin, float** in,
int nout, float** out);
+29 -20
View File
@@ -25,28 +25,37 @@
extern "C" {
#endif
/**
* @file event.h
* @brief Sequencer event functions and defines.
*
* Functions and constants for creating/processing sequencer events.
*/
/**
* Sequencer event type enumeration.
*/
enum fluid_seq_event_type {
FLUID_SEQ_NOTE = 0,
FLUID_SEQ_NOTEON,
FLUID_SEQ_NOTEOFF,
FLUID_SEQ_ALLSOUNDSOFF,
FLUID_SEQ_ALLNOTESOFF,
FLUID_SEQ_BANKSELECT,
FLUID_SEQ_PROGRAMCHANGE,
FLUID_SEQ_PROGRAMSELECT,
FLUID_SEQ_PITCHBEND,
FLUID_SEQ_PITCHWHHELSENS,
FLUID_SEQ_MODULATION,
FLUID_SEQ_SUSTAIN,
FLUID_SEQ_CONTROLCHANGE,
FLUID_SEQ_PAN,
FLUID_SEQ_VOLUME,
FLUID_SEQ_REVERBSEND,
FLUID_SEQ_CHORUSSEND,
FLUID_SEQ_TIMER,
FLUID_SEQ_ANYCONTROLCHANGE, // used for remove_events only
FLUID_SEQ_LASTEVENT
FLUID_SEQ_NOTE = 0, /**< Note event (DOCME) */
FLUID_SEQ_NOTEON, /**< Note on event */
FLUID_SEQ_NOTEOFF, /**< Note off event */
FLUID_SEQ_ALLSOUNDSOFF, /**< All sounds off event */
FLUID_SEQ_ALLNOTESOFF, /**< All notes off event */
FLUID_SEQ_BANKSELECT, /**< Bank select message */
FLUID_SEQ_PROGRAMCHANGE, /**< Program change message */
FLUID_SEQ_PROGRAMSELECT, /**< Program select message (DOCME) */
FLUID_SEQ_PITCHBEND, /**< Pitch bend message */
FLUID_SEQ_PITCHWHHELSENS, /**< Pitch wheel sensitivity set message */
FLUID_SEQ_MODULATION, /**< Modulation controller event */
FLUID_SEQ_SUSTAIN, /**< Sustain controller event */
FLUID_SEQ_CONTROLCHANGE, /**< MIDI control change event */
FLUID_SEQ_PAN, /**< Stereo pan set event */
FLUID_SEQ_VOLUME, /**< Volume set event */
FLUID_SEQ_REVERBSEND, /**< Reverb send set event */
FLUID_SEQ_CHORUSSEND, /**< Chorus send set event */
FLUID_SEQ_TIMER, /**< Timer event (DOCME) */
FLUID_SEQ_ANYCONTROLCHANGE, /**< DOCME (used for remove_events only) */
FLUID_SEQ_LASTEVENT /**< Defines the count of event enums */
};
/* Event alloc/free */
+81 -75
View File
@@ -25,99 +25,105 @@
extern "C" {
#endif
/**
* @file gen.h
* @brief Functions and defines for SoundFont generator effects.
*/
/** List of generator numbers
Soundfont 2.01 specifications section 8.1.3 */
/**
* Generator (effect) numbers (Soundfont 2.01 specifications section 8.1.3)
*/
enum fluid_gen_type {
GEN_STARTADDROFS,
GEN_ENDADDROFS,
GEN_STARTLOOPADDROFS,
GEN_ENDLOOPADDROFS,
GEN_STARTADDRCOARSEOFS,
GEN_MODLFOTOPITCH,
GEN_VIBLFOTOPITCH,
GEN_MODENVTOPITCH,
GEN_FILTERFC,
GEN_FILTERQ,
GEN_MODLFOTOFILTERFC,
GEN_MODENVTOFILTERFC,
GEN_ENDADDRCOARSEOFS,
GEN_MODLFOTOVOL,
GEN_UNUSED1,
GEN_CHORUSSEND,
GEN_REVERBSEND,
GEN_PAN,
GEN_UNUSED2,
GEN_UNUSED3,
GEN_UNUSED4,
GEN_MODLFODELAY,
GEN_MODLFOFREQ,
GEN_VIBLFODELAY,
GEN_VIBLFOFREQ,
GEN_MODENVDELAY,
GEN_MODENVATTACK,
GEN_MODENVHOLD,
GEN_MODENVDECAY,
GEN_MODENVSUSTAIN,
GEN_MODENVRELEASE,
GEN_KEYTOMODENVHOLD,
GEN_KEYTOMODENVDECAY,
GEN_VOLENVDELAY,
GEN_VOLENVATTACK,
GEN_VOLENVHOLD,
GEN_VOLENVDECAY,
GEN_VOLENVSUSTAIN,
GEN_VOLENVRELEASE,
GEN_KEYTOVOLENVHOLD,
GEN_KEYTOVOLENVDECAY,
GEN_INSTRUMENT,
GEN_RESERVED1,
GEN_KEYRANGE,
GEN_VELRANGE,
GEN_STARTLOOPADDRCOARSEOFS,
GEN_KEYNUM,
GEN_VELOCITY,
GEN_ATTENUATION,
GEN_RESERVED2,
GEN_ENDLOOPADDRCOARSEOFS,
GEN_COARSETUNE,
GEN_FINETUNE,
GEN_SAMPLEID,
GEN_SAMPLEMODE,
GEN_RESERVED3,
GEN_SCALETUNE,
GEN_EXCLUSIVECLASS,
GEN_OVERRIDEROOTKEY,
GEN_STARTADDROFS, /**< Sample start address offset (0-32767) */
GEN_ENDADDROFS, /**< Sample end address offset (-32767-0) */
GEN_STARTLOOPADDROFS, /**< Sample loop start address offset (-32767-32767) */
GEN_ENDLOOPADDROFS, /**< Sample loop end address offset (-32767-32767) */
GEN_STARTADDRCOARSEOFS, /**< Sample start address coarse offset (X 32768) */
GEN_MODLFOTOPITCH, /**< Modulation LFO to pitch */
GEN_VIBLFOTOPITCH, /**< Vibrato LFO to pitch */
GEN_MODENVTOPITCH, /**< Modulation envelope to pitch */
GEN_FILTERFC, /**< Filter cutoff */
GEN_FILTERQ, /**< Filter Q */
GEN_MODLFOTOFILTERFC, /**< Modulation LFO to filter cutoff */
GEN_MODENVTOFILTERFC, /**< Modulation envelope to filter cutoff */
GEN_ENDADDRCOARSEOFS, /**< Sample end address coarse offset (X 32768) */
GEN_MODLFOTOVOL, /**< Modulation LFO to volume */
GEN_UNUSED1, /**< Unused */
GEN_CHORUSSEND, /**< Chorus send amount */
GEN_REVERBSEND, /**< Reverb send amount */
GEN_PAN, /**< Stereo panning */
GEN_UNUSED2, /**< Unused */
GEN_UNUSED3, /**< Unused */
GEN_UNUSED4, /**< Unused */
GEN_MODLFODELAY, /**< Modulation LFO delay */
GEN_MODLFOFREQ, /**< Modulation LFO frequency */
GEN_VIBLFODELAY, /**< Vibrato LFO delay */
GEN_VIBLFOFREQ, /**< Vibrato LFO frequency */
GEN_MODENVDELAY, /**< Modulation envelope delay */
GEN_MODENVATTACK, /**< Modulation envelope attack */
GEN_MODENVHOLD, /**< Modulation envelope hold */
GEN_MODENVDECAY, /**< Modulation envelope decay */
GEN_MODENVSUSTAIN, /**< Modulation envelope sustain */
GEN_MODENVRELEASE, /**< Modulation envelope release */
GEN_KEYTOMODENVHOLD, /**< Key to modulation envelope hold */
GEN_KEYTOMODENVDECAY, /**< Key to modulation envelope decay */
GEN_VOLENVDELAY, /**< Volume envelope delay */
GEN_VOLENVATTACK, /**< Volume envelope attack */
GEN_VOLENVHOLD, /**< Volume envelope hold */
GEN_VOLENVDECAY, /**< Volume envelope decay */
GEN_VOLENVSUSTAIN, /**< Volume envelope sustain */
GEN_VOLENVRELEASE, /**< Volume envelope release */
GEN_KEYTOVOLENVHOLD, /**< Key to volume envelope hold */
GEN_KEYTOVOLENVDECAY, /**< Key to volume envelope decay */
GEN_INSTRUMENT, /**< Instrument ID (shouldn't be set by user) */
GEN_RESERVED1, /**< Reserved */
GEN_KEYRANGE, /**< MIDI note range */
GEN_VELRANGE, /**< MIDI velocity range */
GEN_STARTLOOPADDRCOARSEOFS, /**< Sample start loop address coarse offset (X 32768) */
GEN_KEYNUM, /**< Fixed MIDI note number */
GEN_VELOCITY, /**< Fixed MIDI velocity value */
GEN_ATTENUATION, /**< Initial volume attenuation */
GEN_RESERVED2, /**< Reserved */
GEN_ENDLOOPADDRCOARSEOFS, /**< Sample end loop address coarse offset (X 32768) */
GEN_COARSETUNE, /**< Coarse tuning */
GEN_FINETUNE, /**< Fine tuning */
GEN_SAMPLEID, /**< Sample ID (shouldn't be set by user) */
GEN_SAMPLEMODE, /**< Sample mode flags */
GEN_RESERVED3, /**< Reserved */
GEN_SCALETUNE, /**< Scale tuning */
GEN_EXCLUSIVECLASS, /**< Exclusive class number */
GEN_OVERRIDEROOTKEY, /**< Sample root note override */
/* the initial pitch is not a "standard" generator. It is not
* mentioned in the list of generator in the SF2 specifications. It
* is used, however, as the destination for the default pitch wheel
* modulator. */
GEN_PITCH,
GEN_LAST
GEN_PITCH, /**< Pitch (NOTE: Not a real SoundFont generator) */
GEN_LAST /**< Value defines the count of generators (#fluid_gen_type) */
};
/*
* fluid_gen_t
* Sound font generator
*/
/**
* SoundFont generator structure.
*/
typedef struct _fluid_gen_t
{
unsigned char flags; /* is it used or not */
double val; /* The nominal value */
double mod; /* Change by modulators */
double nrpn; /* Change by NRPN messages */
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,
GEN_SET,
GEN_ABS_NRPN
GEN_UNUSED, /**< Generator value is not set */
GEN_SET, /**< Generator value is set */
GEN_ABS_NRPN /**< DOCME */
};
/** Reset an array of generators to the SF2.01 default values */
FLUIDSYNTH_API int fluid_gen_set_default_values(fluid_gen_t* gen);
+34 -36
View File
@@ -27,57 +27,55 @@ extern "C" {
#endif
/**
*
* Logging interface
*
* The default logging function of the fluidsynth prints its messages
* to the stderr. The synthesizer uses four level of messages: FLUID_PANIC,
* ERR, WARN, and FLUID_DBG. They are commented in the definition below.
*
* A client application can install a new log function to handle the
* messages differently. In the following example, the application
* sets a callback function to display "FLUID_PANIC" messages in a dialog,
* and ignores all other messages by setting the log function to
* NULL:
*
* ...
* fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
* fluid_set_log_function(ERR, NULL, NULL);
* fluid_set_log_function(WARN, NULL, NULL);
* fluid_set_log_function(FLUID_DBG, NULL, NULL);
* ...
*
*/
/**
* @file log.h
* @brief Logging interface
*
* The default logging function of the fluidsynth prints its messages
* to the stderr. The synthesizer uses five level of messages: #FLUID_PANIC,
* #FLUID_ERR, #FLUID_WARN, #FLUID_INFO, and #FLUID_DBG.
*
* A client application can install a new log function to handle the
* messages differently. In the following example, the application
* sets a callback function to display #FLUID_PANIC messages in a dialog,
* and ignores all other messages by setting the log function to
* NULL:
*
* DOCME (formatting)
* fluid_set_log_function(FLUID_PANIC, show_dialog, (void*) root_window);
* fluid_set_log_function(FLUID_ERR, NULL, NULL);
* fluid_set_log_function(FLUID_WARN, NULL, NULL);
* fluid_set_log_function(FLUID_DBG, NULL, NULL);
*/
/**
* FluidSynth log levels.
*/
enum fluid_log_level {
FLUID_PANIC, /* the synth can't function correctly any more */
FLUID_ERR, /* the synth can function, but with serious limitation */
FLUID_WARN, /* the synth might not function as expected */
FLUID_INFO, /* verbose messages */
FLUID_DBG, /* debugging messages */
FLUID_PANIC, /**< The synth can't function correctly any more */
FLUID_ERR, /**< Serious error occurred */
FLUID_WARN, /**< Warning */
FLUID_INFO, /**< Verbose informational messages */
FLUID_DBG, /**< Debugging messages */
LAST_LOG_LEVEL
};
/**
* Log function handler callback type used by fluid_set_log_function().
* @param level Log level (#fluid_log_level)
* @param message Log message text
* @param data User data pointer supplied to fluid_set_log_function().
*/
typedef void (*fluid_log_function_t)(int level, char* message, void* data);
/** fluid_set_log_function installs a new log function for the
* specified level. It returns the previously installed function.
*/
FLUIDSYNTH_API
fluid_log_function_t fluid_set_log_function(int level, fluid_log_function_t fun, void* data);
/** fluid_default_log_function is the fluid's default log function. It
* prints to the stderr. */
FLUIDSYNTH_API void fluid_default_log_function(int level, char* message, void* data);
/** print a message to the log */
FLUIDSYNTH_API int fluid_log(int level, char * fmt, ...);
#ifdef __cplusplus
}
#endif
+21 -37
View File
@@ -25,7 +25,10 @@
extern "C" {
#endif
/**
* @file midi.h
* @brief Functions for MIDI events, drivers and MIDI file playback.
*/
FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event(void);
FLUIDSYNTH_API int delete_fluid_midi_event(fluid_midi_event_t* event);
@@ -48,58 +51,41 @@ FLUIDSYNTH_API int fluid_midi_event_get_pitch(fluid_midi_event_t* evt);
FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t* evt, int val);
/* Generic callback function for MIDI events.
* Will be used between
* - MIDI driver and MIDI router
* - MIDI router and synth
* to communicate events.
* In the not-so-far future...
*/
/**
* Generic callback function for MIDI events.
* @param data User defined data pointer
* @param event The MIDI event
* @return DOCME
*
* Will be used between
* - MIDI driver and MIDI router
* - MIDI router and synth
* to communicate events.
* In the not-so-far future...
*/
typedef int (*handle_midi_event_func_t)(void* data, fluid_midi_event_t* event);
/*
*
* MIDI router
*
* The MIDI handler forwards incoming MIDI events to the synthesizer
*
*/
/*
* MIDI router
*
* The MIDI handler forwards incoming MIDI events to the synthesizer
*/
/** Create a new midi router. A midi handler connects to a midi input
* device and forwards incoming midi events to the synthesizer.
*/
FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* settings,
handle_midi_event_func_t handler,
void* event_handler_data);
/** Delete the midi router.
*
* \param handler a pointer to the midi handler
* \return 0 if no error occured, -1 otherwise
*/
FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler);
/** The standard handler function. Every MIDI event goes through
this. */
FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void* data, fluid_midi_event_t* event);
/** An optional link in the MIDI chain to dump MIDI data between MIDI
driver and router */
FLUIDSYNTH_API int fluid_midi_dump_prerouter(void* data, fluid_midi_event_t* event);
/** An optional link in the MIDI chain to dump MIDI data between MIDI
router and the synthesizer */
FLUIDSYNTH_API int fluid_midi_dump_postrouter(void* data, fluid_midi_event_t* event);
/*
*
* MIDI driver
*
* The MIDI handler forwards incoming MIDI events to the synthesizer
*
*/
FLUIDSYNTH_API
fluid_midi_driver_t* new_fluid_midi_driver(fluid_settings_t* settings,
handle_midi_event_func_t handler,
@@ -110,11 +96,9 @@ FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t* driver);
/*
*
* MIDI file player
*
* The MIDI player allows you to play MIDI files with the FLUID Synth
*
*/
FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth);
+2 -2
View File
@@ -144,9 +144,9 @@ struct _fluid_sample_t
{
char name[21];
unsigned int start;
unsigned int end;
unsigned int end; /* Note: Index of last valid sample point (contrary to SF spec) */
unsigned int loopstart;
unsigned int loopend;
unsigned int loopend; /* Note: first point following the loop (superimposed on loopstart) */
unsigned int samplerate;
int origpitch;
int pitchadj;
+2 -2
View File
@@ -26,10 +26,10 @@
extern "C" {
#endif
#define FLUIDSYNTH_VERSION "1.0.7"
#define FLUIDSYNTH_VERSION "1.0.8"
#define FLUIDSYNTH_VERSION_MAJOR 1
#define FLUIDSYNTH_VERSION_MINOR 0
#define FLUIDSYNTH_VERSION_MICRO 7
#define FLUIDSYNTH_VERSION_MICRO 8
FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro);