From db92ea15c8cc73ec2ff35063be51494f1930ba20 Mon Sep 17 00:00:00 2001 From: Alex Birch Date: Sun, 17 Jun 2018 15:56:35 +0100 Subject: [PATCH] update fluidsynth includes to commit fluidsynth commit v2.0.0.beta1 --- include/fluidsynth.h | 1 + include/fluidsynth/audio.h | 21 +- include/fluidsynth/event.h | 10 +- include/fluidsynth/gen.h | 37 +--- include/fluidsynth/ladspa.h | 65 ++++++ include/fluidsynth/log.h | 4 +- include/fluidsynth/midi.h | 17 +- include/fluidsynth/misc.h | 10 +- include/fluidsynth/mod.h | 48 ++--- include/fluidsynth/ramsfont.h | 14 +- include/fluidsynth/seq.h | 4 +- include/fluidsynth/settings.h | 49 +---- include/fluidsynth/sfont.h | 390 +++++++++++++++++----------------- include/fluidsynth/shell.h | 40 +--- include/fluidsynth/synth.h | 256 +++++++++++++--------- include/fluidsynth/types.h | 6 +- include/fluidsynth/version.h | 8 +- include/fluidsynth/voice.h | 17 +- 18 files changed, 515 insertions(+), 482 deletions(-) create mode 100644 include/fluidsynth/ladspa.h diff --git a/include/fluidsynth.h b/include/fluidsynth.h index 784e783..cbe71a5 100644 --- a/include/fluidsynth.h +++ b/include/fluidsynth.h @@ -109,6 +109,7 @@ extern "C" { #include "fluidsynth/gen.h" #include "fluidsynth/voice.h" #include "fluidsynth/version.h" +#include "fluidsynth/ladspa.h" #ifdef __cplusplus diff --git a/include/fluidsynth/audio.h b/include/fluidsynth/audio.h index 795a000..8341b81 100644 --- a/include/fluidsynth/audio.h +++ b/include/fluidsynth/audio.h @@ -41,19 +41,20 @@ extern "C" { /** * 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. + * custom user audio processing before the audio is sent to the driver. This + * function is responsible for rendering the audio to the buffers. For details + * please refer to fluid_synth_process(). * @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 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. + * @param len Count of audio frames to synthesize. + * @param nfx Count of arrays in \c fx. + * @param fx Array of buffers to store effects audio to. Buffers may alias with buffers of \c out. + * @param nout Count of arrays in \c out. + * @param out Array of buffers to store (dry) audio to. Buffers may alias with buffers of \c fx. + * @return Should return #FLUID_OK on success, #FLUID_FAILED if an error occured. */ typedef int (*fluid_audio_func_t)(void* data, int len, - int nin, float** in, - int nout, float** out); + int nfx, float* fx[], + int nout, float* out[]); FLUIDSYNTH_API fluid_audio_driver_t* new_fluid_audio_driver(fluid_settings_t* settings, fluid_synth_t* synth); diff --git a/include/fluidsynth/event.h b/include/fluidsynth/event.h index 1676163..1f60107 100644 --- a/include/fluidsynth/event.h +++ b/include/fluidsynth/event.h @@ -43,7 +43,7 @@ enum fluid_seq_event_type { 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_PROGRAMSELECT, /**< Program select message */ FLUID_SEQ_PITCHBEND, /**< Pitch bend message */ FLUID_SEQ_PITCHWHEELSENS, /**< Pitch wheel sensitivity set message @since 1.1.0 was mispelled previously */ FLUID_SEQ_MODULATION, /**< Modulation controller event */ @@ -56,13 +56,14 @@ enum fluid_seq_event_type { FLUID_SEQ_TIMER, /**< Timer event (useful for giving a callback at a certain time) */ FLUID_SEQ_ANYCONTROLCHANGE, /**< Any control change message (only internally used for remove_events) */ FLUID_SEQ_CHANNELPRESSURE, /**< Channel aftertouch event @since 1.1.0 */ + FLUID_SEQ_KEYPRESSURE, /**< Polyphonic aftertouch event @since 2.0.0 */ FLUID_SEQ_SYSTEMRESET, /**< System reset event @since 1.1.0 */ FLUID_SEQ_UNREGISTERING, /**< Called when a sequencer client is being unregistered. @since 1.1.0 */ - FLUID_SEQ_LASTEVENT /**< Defines the count of event enums @deprecated As of 1.1.7 this enum value is deprecated and will be removed in a future release, because it prevents adding new enum values without breaking ABI compatibility. */ +#ifndef __DOXYGEN__ + FLUID_SEQ_LASTEVENT /**< @internal Defines the count of events enums @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +#endif }; -#define FLUID_SEQ_PITCHWHHELSENS FLUID_SEQ_PITCHWHEELSENS /**< Old deprecated misspelling of #FLUID_SEQ_PITCHWHEELSENS */ - /* Event alloc/free */ FLUIDSYNTH_API fluid_event_t* new_fluid_event(void); FLUIDSYNTH_API void delete_fluid_event(fluid_event_t* evt); @@ -103,6 +104,7 @@ FLUIDSYNTH_API void fluid_event_volume(fluid_event_t* evt, int channel, short va FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t* evt, int channel, short val); FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t* evt, int channel, short val); +FLUIDSYNTH_API void fluid_event_key_pressure(fluid_event_t* evt, int channel, short key, short val); FLUIDSYNTH_API void fluid_event_channel_pressure(fluid_event_t* evt, int channel, short val); FLUIDSYNTH_API void fluid_event_system_reset(fluid_event_t* evt); diff --git a/include/fluidsynth/gen.h b/include/fluidsynth/gen.h index f4b7f47..74ccd21 100644 --- a/include/fluidsynth/gen.h +++ b/include/fluidsynth/gen.h @@ -98,36 +98,19 @@ enum fluid_gen_type { * 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, /**< Pitch (NOTE: Not a real SoundFont generator) */ - GEN_LAST /**< Value defines the count of generators (#fluid_gen_type) @deprecated As of 1.1.7 this enum value is deprecated and will be removed in a future release, because it prevents adding new enum values without breaking ABI compatibility. */ + GEN_PITCH, /**< Pitch @note Not a real SoundFont generator */ + + GEN_CUSTOM_BALANCE, /**< Balance @note Not a real SoundFont generator */ + /* non-standard generator for an additional custom high- or low-pass filter */ + GEN_CUSTOM_FILTERFC, /**< Custom filter cutoff frequency */ + GEN_CUSTOM_FILTERQ, /**< Custom filter Q */ + +#ifndef __DOXYGEN__ + GEN_LAST /**< @internal Value defines the count of generators (#fluid_gen_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +#endif }; -/** - * 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 */ -}; - -FLUIDSYNTH_API FLUID_DEPRECATED int fluid_gen_set_default_values(fluid_gen_t* gen); - - - #ifdef __cplusplus } #endif diff --git a/include/fluidsynth/ladspa.h b/include/fluidsynth/ladspa.h new file mode 100644 index 0000000..f12bb33 --- /dev/null +++ b/include/fluidsynth/ladspa.h @@ -0,0 +1,65 @@ +/* FluidSynth - A Software Synthesizer + * + * Copyright (C) 2003 Peter Hanappe and others. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA + */ + +#ifndef _FLUIDSYNTH_LADSPA_H +#define _FLUIDSYNTH_LADSPA_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file ladspa.h + * @brief Functions for manipulating the ladspa effects unit + * + * This header defines useful functions for programatically manipulating the ladspa + * effects unit of the synth that can be retrieved via fluid_synth_get_ladspa_fx(). + * + * Using any of those functions requires fluidsynth to be compiled with ladspa support. + * Else all of those functions are useless dummies. + */ + +FLUIDSYNTH_API int fluid_ladspa_is_active(fluid_ladspa_fx_t *fx); +FLUIDSYNTH_API int fluid_ladspa_activate(fluid_ladspa_fx_t *fx); +FLUIDSYNTH_API int fluid_ladspa_deactivate(fluid_ladspa_fx_t *fx); +FLUIDSYNTH_API int fluid_ladspa_reset(fluid_ladspa_fx_t *fx); +FLUIDSYNTH_API int fluid_ladspa_check(fluid_ladspa_fx_t *fx, char *err, int err_size); + +FLUIDSYNTH_API int fluid_ladspa_host_port_exists(fluid_ladspa_fx_t *fx, const char *name); + +FLUIDSYNTH_API int fluid_ladspa_add_buffer(fluid_ladspa_fx_t *fx, const char *name); +FLUIDSYNTH_API int fluid_ladspa_buffer_exists(fluid_ladspa_fx_t *fx, const char *name); + +FLUIDSYNTH_API int fluid_ladspa_add_effect(fluid_ladspa_fx_t *fx, const char *effect_name, + const char *lib_name, const char *plugin_name); +FLUIDSYNTH_API int fluid_ladspa_effect_can_mix(fluid_ladspa_fx_t *fx, const char *name); +FLUIDSYNTH_API int fluid_ladspa_effect_set_mix(fluid_ladspa_fx_t *fx, const char *name, int mix, float gain); +FLUIDSYNTH_API int fluid_ladspa_effect_port_exists(fluid_ladspa_fx_t *fx, const char *effect_name, const char *port_name); +FLUIDSYNTH_API int fluid_ladspa_effect_set_control(fluid_ladspa_fx_t *fx, const char *effect_name, + const char *port_name, float val); +FLUIDSYNTH_API int fluid_ladspa_effect_link(fluid_ladspa_fx_t *fx, const char *effect_name, + const char *port_name, const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* _FLUIDSYNTH_LADSPA_H */ + diff --git a/include/fluidsynth/log.h b/include/fluidsynth/log.h index cd9f404..61bbef2 100644 --- a/include/fluidsynth/log.h +++ b/include/fluidsynth/log.h @@ -58,7 +58,9 @@ enum fluid_log_level { FLUID_WARN, /**< Warning */ FLUID_INFO, /**< Verbose informational messages */ FLUID_DBG, /**< Debugging messages */ - LAST_LOG_LEVEL /**< @deprecated As of 1.1.7 this enum value is deprecated and will be removed in a future release, because it prevents adding new enum values without breaking ABI compatibility. */ +#ifndef __DOXYGEN__ + LAST_LOG_LEVEL /**< @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +#endif }; /** diff --git a/include/fluidsynth/midi.h b/include/fluidsynth/midi.h index bd991a0..dafc034 100644 --- a/include/fluidsynth/midi.h +++ b/include/fluidsynth/midi.h @@ -31,7 +31,7 @@ extern "C" { */ FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event(void); -FLUIDSYNTH_API int delete_fluid_midi_event(fluid_midi_event_t* event); +FLUIDSYNTH_API void delete_fluid_midi_event(fluid_midi_event_t* event); FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t* evt, int type); FLUIDSYNTH_API int fluid_midi_event_get_type(fluid_midi_event_t* evt); @@ -51,6 +51,10 @@ 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); FLUIDSYNTH_API int fluid_midi_event_set_sysex(fluid_midi_event_t* evt, void *data, int size, int dynamic); +FLUIDSYNTH_API int fluid_midi_event_set_text(fluid_midi_event_t *evt, + void *data, int size, int dynamic); +FLUIDSYNTH_API int fluid_midi_event_set_lyrics(fluid_midi_event_t *evt, + void *data, int size, int dynamic); /** * MIDI router rule type. @@ -64,7 +68,9 @@ typedef enum 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 */ +#ifndef __DOXYGEN__ + FLUID_MIDI_ROUTER_RULE_COUNT /**< @internal Total count of rule types @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time!*/ +#endif } fluid_midi_router_rule_type; /** @@ -84,7 +90,7 @@ typedef int (*handle_midi_event_func_t)(void* data, fluid_midi_event_t* event); FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* settings, handle_midi_event_func_t handler, void* event_handler_data); -FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler); +FLUIDSYNTH_API void 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, @@ -122,7 +128,7 @@ enum fluid_player_status }; FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth); -FLUIDSYNTH_API int delete_fluid_player(fluid_player_t* player); +FLUIDSYNTH_API void delete_fluid_player(fluid_player_t* player); FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, const char *midifile); FLUIDSYNTH_API int fluid_player_add_mem(fluid_player_t* player, const void *buffer, size_t len); FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player); @@ -138,7 +144,8 @@ FLUIDSYNTH_API int fluid_player_get_current_tick(fluid_player_t * player); FLUIDSYNTH_API int fluid_player_get_total_ticks(fluid_player_t * player); FLUIDSYNTH_API int fluid_player_get_bpm(fluid_player_t * player); FLUIDSYNTH_API int fluid_player_get_midi_tempo(fluid_player_t * player); - +FLUIDSYNTH_API int fluid_player_seek(fluid_player_t *player, int ticks); + /// #ifdef __cplusplus diff --git a/include/fluidsynth/misc.h b/include/fluidsynth/misc.h index 3845e30..6e0bf65 100644 --- a/include/fluidsynth/misc.h +++ b/include/fluidsynth/misc.h @@ -36,7 +36,7 @@ extern "C" { * Value that indicates success, used by most libfluidsynth functions. * @since 1.1.0 * - * NOTE: This was not publicly defined prior to libfluidsynth 1.1.0. When + * @note This was not publicly defined prior to libfluidsynth 1.1.0. When * writing code which should also be compatible with older versions, something * like the following can be used: * @@ -55,7 +55,7 @@ extern "C" { * Value that indicates failure, used by most libfluidsynth functions. * @since 1.1.0 * - * NOTE: See #FLUID_OK for more details. + * @note See #FLUID_OK for more details. */ #define FLUID_FAILED (-1) @@ -64,12 +64,6 @@ FLUIDSYNTH_API int fluid_is_soundfont (const char *filename); FLUIDSYNTH_API int fluid_is_midifile (const char *filename); -#ifdef WIN32 -FLUIDSYNTH_API FLUID_DEPRECATED void* fluid_get_hinstance(void); -FLUIDSYNTH_API FLUID_DEPRECATED void fluid_set_hinstance(void* hinstance); -#endif - - #ifdef __cplusplus } #endif diff --git a/include/fluidsynth/mod.h b/include/fluidsynth/mod.h index a50c521..2449fdb 100644 --- a/include/fluidsynth/mod.h +++ b/include/fluidsynth/mod.h @@ -30,28 +30,6 @@ extern "C" { * @brief SoundFont modulator functions and constants. */ -#define FLUID_NUM_MOD 64 /**< Maximum number of modulators in a voice */ - -/** - * Modulator structure. See SoundFont 2.04 PDF section 8.2. - * - * @deprecated To be removed from the public API. - */ -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; -}; /** * Flags defining the polarity, mapping function and type of a modulator source. @@ -71,7 +49,9 @@ enum fluid_mod_flags FLUID_MOD_CONVEX = 8, /**< Convex mapping function */ FLUID_MOD_SWITCH = 12, /**< Switch (on/off) mapping function */ FLUID_MOD_GC = 0, /**< General controller source type (#fluid_mod_src) */ - FLUID_MOD_CC = 16 /**< MIDI CC controller (source will be a MIDI CC number) */ + FLUID_MOD_CC = 16, /**< MIDI CC controller (source will be a MIDI CC number) */ + + FLUID_MOD_SIN = 0x80, /**< Custom non-standard sinus mapping function */ }; /** @@ -89,23 +69,27 @@ enum fluid_mod_src FLUID_MOD_PITCHWHEELSENS = 16 /**< Pitch wheel sensitivity */ }; -FLUIDSYNTH_API fluid_mod_t* fluid_mod_new(void); -FLUIDSYNTH_API void fluid_mod_delete(fluid_mod_t * mod); +FLUIDSYNTH_API fluid_mod_t* new_fluid_mod(void); +FLUIDSYNTH_API void delete_fluid_mod(fluid_mod_t * mod); +FLUIDSYNTH_API size_t fluid_mod_sizeof(void); FLUIDSYNTH_API void fluid_mod_set_source1(fluid_mod_t* mod, int src, int flags); FLUIDSYNTH_API void fluid_mod_set_source2(fluid_mod_t* mod, int src, int flags); FLUIDSYNTH_API void fluid_mod_set_dest(fluid_mod_t* mod, int dst); FLUIDSYNTH_API void fluid_mod_set_amount(fluid_mod_t* mod, double amount); -FLUIDSYNTH_API int fluid_mod_get_source1(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_flags1(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_source2(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_flags2(fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_get_dest(fluid_mod_t* mod); -FLUIDSYNTH_API double fluid_mod_get_amount(fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_source1(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_flags1(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_source2(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_flags2(const fluid_mod_t* mod); +FLUIDSYNTH_API int fluid_mod_get_dest(const fluid_mod_t* mod); +FLUIDSYNTH_API double fluid_mod_get_amount(const fluid_mod_t* mod); -FLUIDSYNTH_API int fluid_mod_test_identity(fluid_mod_t * mod1, fluid_mod_t * mod2); +FLUIDSYNTH_API int fluid_mod_test_identity(const fluid_mod_t * mod1, const fluid_mod_t * mod2); +FLUIDSYNTH_API int fluid_mod_has_source(const fluid_mod_t * mod, int cc, int ctrl); +FLUIDSYNTH_API int fluid_mod_has_dest(const fluid_mod_t * mod, int gen); +FLUIDSYNTH_API void fluid_mod_clone(fluid_mod_t* mod, const fluid_mod_t* src); #ifdef __cplusplus } diff --git a/include/fluidsynth/ramsfont.h b/include/fluidsynth/ramsfont.h index c4cf945..7d3d1eb 100644 --- a/include/fluidsynth/ramsfont.h +++ b/include/fluidsynth/ramsfont.h @@ -43,26 +43,20 @@ FLUIDSYNTH_API fluid_sfont_t* fluid_ramsfont_create_sfont(void); FLUIDSYNTH_API int fluid_ramsfont_set_name(fluid_ramsfont_t* sfont, const char *name); FLUIDSYNTH_API int fluid_ramsfont_add_izone(fluid_ramsfont_t* sfont, - unsigned int bank, unsigned int num, fluid_sample_t* sample, + int bank, int num, fluid_sample_t* sample, int lokey, int hikey); FLUIDSYNTH_API int fluid_ramsfont_remove_izone(fluid_ramsfont_t* sfont, - unsigned int bank, unsigned int num, fluid_sample_t* sample); + int bank, int num, fluid_sample_t* sample); FLUIDSYNTH_API int fluid_ramsfont_izone_set_gen(fluid_ramsfont_t* sfont, - unsigned int bank, unsigned int num, fluid_sample_t* sample, + int bank, int num, fluid_sample_t* sample, int gen_type, float value); FLUIDSYNTH_API int fluid_ramsfont_izone_set_loop(fluid_ramsfont_t* sfont, - unsigned int bank, unsigned int num, fluid_sample_t* sample, + int bank, int num, fluid_sample_t* sample, int on, float loopstart, float loopend); -FLUIDSYNTH_API fluid_sample_t* new_fluid_ramsample(void); -FLUIDSYNTH_API int delete_fluid_ramsample(fluid_sample_t* sample); -FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, const char *name); -FLUIDSYNTH_API -int fluid_sample_set_sound_data(fluid_sample_t* sample, short *data, - unsigned int nbframes, short copy_data, int rootkey); #ifdef __cplusplus diff --git a/include/fluidsynth/seq.h b/include/fluidsynth/seq.h index 9f0ee6c..69056fc 100644 --- a/include/fluidsynth/seq.h +++ b/include/fluidsynth/seq.h @@ -51,8 +51,8 @@ fluid_seq_id_t fluid_sequencer_register_client(fluid_sequencer_t* seq, const cha FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, fluid_seq_id_t id); FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t* seq); FLUIDSYNTH_API fluid_seq_id_t fluid_sequencer_get_client_id(fluid_sequencer_t* seq, int index); -FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id); -FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id); +FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, fluid_seq_id_t id); +FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, fluid_seq_id_t id); FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t* seq, unsigned int msec); FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t* seq, fluid_event_t* evt); FLUIDSYNTH_API diff --git a/include/fluidsynth/settings.h b/include/fluidsynth/settings.h index 5551b92..0784d99 100644 --- a/include/fluidsynth/settings.h +++ b/include/fluidsynth/settings.h @@ -78,35 +78,6 @@ extern "C" { */ #define FLUID_HINT_TOGGLED 0x4 -/** - * Hint FLUID_HINT_SAMPLE_RATE indicates that any bounds specified - * should be interpreted as multiples of the sample rate. For - * instance, a frequency range from 0Hz to the Nyquist frequency (half - * the sample rate) could be requested by this hint in conjunction - * with LowerBound = 0 and UpperBound = 0.5. Hosts that support bounds - * at all must support this hint to retain meaning. - */ -#define FLUID_HINT_SAMPLE_RATE 0x8 - -/** - * Hint FLUID_HINT_LOGARITHMIC indicates that it is likely that the - * user will find it more intuitive to view values using a logarithmic - * scale. This is particularly useful for frequencies and gains. - */ -#define FLUID_HINT_LOGARITHMIC 0x10 - -/** - * Hint FLUID_HINT_INTEGER indicates that a user interface would - * probably wish to provide a stepped control taking only integer - * values. - * @deprecated - * - * As there is an integer setting type, this hint is not used. - */ -#define FLUID_HINT_INTEGER 0x20 - - -#define FLUID_HINT_FILENAME 0x01 /**< String setting is a file name */ #define FLUID_HINT_OPTIONLIST 0x02 /**< Setting is a list of string options */ @@ -133,7 +104,7 @@ FLUIDSYNTH_API int fluid_settings_get_type(fluid_settings_t* settings, const char *name); FLUIDSYNTH_API -int fluid_settings_get_hints(fluid_settings_t* settings, const char *name); +int fluid_settings_get_hints(fluid_settings_t* settings, const char *name, int* val); FLUIDSYNTH_API int fluid_settings_is_realtime(fluid_settings_t* settings, const char *name); @@ -148,11 +119,7 @@ FLUIDSYNTH_API int fluid_settings_dupstr(fluid_settings_t* settings, const char *name, char** str); FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_settings_getstr(fluid_settings_t* settings, const char *name, char** str); - -FLUIDSYNTH_API -char* fluid_settings_getstr_default(fluid_settings_t* settings, const char *name); +int fluid_settings_getstr_default(fluid_settings_t* settings, const char *name, char** def); FLUIDSYNTH_API int fluid_settings_str_equal(fluid_settings_t* settings, const char *name, const char *value); @@ -164,10 +131,10 @@ FLUIDSYNTH_API int fluid_settings_getnum(fluid_settings_t* settings, const char *name, double* val); FLUIDSYNTH_API -double fluid_settings_getnum_default(fluid_settings_t* settings, const char *name); +int fluid_settings_getnum_default(fluid_settings_t* settings, const char *name, double* val); FLUIDSYNTH_API -void fluid_settings_getnum_range(fluid_settings_t* settings, const char *name, +int fluid_settings_getnum_range(fluid_settings_t* settings, const char *name, double* min, double* max); FLUIDSYNTH_API @@ -177,10 +144,10 @@ FLUIDSYNTH_API int fluid_settings_getint(fluid_settings_t* settings, const char *name, int* val); FLUIDSYNTH_API -int fluid_settings_getint_default(fluid_settings_t* settings, const char *name); +int fluid_settings_getint_default(fluid_settings_t* settings, const char *name, int* val); FLUIDSYNTH_API -void fluid_settings_getint_range(fluid_settings_t* settings, const char *name, +int fluid_settings_getint_range(fluid_settings_t* settings, const char *name, int* min, int* max); /** @@ -189,7 +156,7 @@ void fluid_settings_getint_range(fluid_settings_t* settings, const char *name, * @param name Setting name * @param option A string option for this setting (iterates through the list) */ -typedef void (*fluid_settings_foreach_option_t)(void *data, char *name, char *option); +typedef void (*fluid_settings_foreach_option_t)(void *data, const char *name, const char *option); FLUIDSYNTH_API void fluid_settings_foreach_option(fluid_settings_t* settings, @@ -207,7 +174,7 @@ FLUIDSYNTH_API char *fluid_settings_option_concat (fluid_settings_t* settings, * @param name Setting name * @param type Setting type (#fluid_types_enum) */ -typedef void (*fluid_settings_foreach_t)(void *data, char *name, int type); +typedef void (*fluid_settings_foreach_t)(void *data, const char *name, int type); FLUIDSYNTH_API void fluid_settings_foreach(fluid_settings_t* settings, void* data, diff --git a/include/fluidsynth/sfont.h b/include/fluidsynth/sfont.h index 4bfce9e..d84c33d 100644 --- a/include/fluidsynth/sfont.h +++ b/include/fluidsynth/sfont.h @@ -70,210 +70,212 @@ enum { FLUID_SAMPLE_DONE /**< Sample no longer needed notify */ }; - /** - * SoundFont loader structure. + * Indicates the type of a sample used by the _fluid_sample_t::sampletype field. */ -struct _fluid_sfloader_t { - void* data; /**< User defined data pointer used by _fluid_sfloader_t::load() */ - - /** - * The free method should free the memory allocated for the loader in - * addition to any private data. - * @param loader SoundFont loader - * @return Should return 0 if no error occured, non-zero otherwise - */ - int (*free)(fluid_sfloader_t* loader); - - /** - * Method to load an instrument file (does not actually need to be a real file name, - * could be another type of string identifier that the \a loader understands). - * @param loader SoundFont loader - * @param filename File name or other string identifier - * @return The loaded instrument file (SoundFont) or NULL if an error occured. - */ - fluid_sfont_t* (*load)(fluid_sfloader_t* loader, const char* filename); -}; - -/** - * Virtual SoundFont instance structure. - */ -struct _fluid_sfont_t { - void* data; /**< User defined data */ - unsigned int id; /**< SoundFont ID */ - - /** - * Method to free a virtual SoundFont bank. - * @param sfont Virtual SoundFont to free. - * @return Should return 0 when it was able to free all resources or non-zero - * if some of the samples could not be freed because they are still in use, - * in which case the free will be tried again later, until success. - */ - int (*free)(fluid_sfont_t* sfont); - - /** - * Method to return the name of a virtual SoundFont. - * @param sfont Virtual SoundFont - * @return The name of the virtual SoundFont. - */ - char* (*get_name)(fluid_sfont_t* sfont); - - /** - * Get a virtual SoundFont preset by bank and program numbers. - * @param sfont Virtual SoundFont - * @param bank MIDI bank number (0-16383) - * @param prenum MIDI preset number (0-127) - * @return Should return an allocated virtual preset or NULL if it could not - * be found. - */ - fluid_preset_t* (*get_preset)(fluid_sfont_t* sfont, unsigned int bank, unsigned int prenum); - - /** - * Start virtual SoundFont preset iteration method. - * @param sfont Virtual SoundFont - * - * Starts/re-starts virtual preset iteration in a SoundFont. - */ - void (*iteration_start)(fluid_sfont_t* sfont); - - /** - * Virtual SoundFont preset iteration function. - * @param sfont Virtual SoundFont - * @param preset Caller supplied preset to fill in with current preset information - * @return 0 when no more presets are available, 1 otherwise - * - * Should store preset information to the caller supplied \a preset structure - * and advance the internal iteration state to the next preset for subsequent - * calls. - */ - int (*iteration_next)(fluid_sfont_t* sfont, fluid_preset_t* preset); -}; - -#define fluid_sfont_get_id(_sf) ((_sf)->id) - -/** - * Virtual SoundFont preset. - */ -struct _fluid_preset_t { - void* data; /**< User supplied data */ - fluid_sfont_t* sfont; /**< Parent virtual SoundFont */ - - /** - * Method to free a virtual SoundFont preset. - * @param preset Virtual SoundFont preset - * @return Should return 0 - */ - int (*free)(fluid_preset_t* preset); - - /** - * Method to get a virtual SoundFont preset name. - * @param preset Virtual SoundFont preset - * @return Should return the name of the preset. The returned string must be - * valid for the duration of the virtual preset (or the duration of the - * SoundFont, in the case of preset iteration). - */ - char* (*get_name)(fluid_preset_t* preset); - - /** - * Method to get a virtual SoundFont preset MIDI bank number. - * @param preset Virtual SoundFont preset - * @param return The bank number of the preset - */ - int (*get_banknum)(fluid_preset_t* preset); - - /** - * Method to get a virtual SoundFont preset MIDI program number. - * @param preset Virtual SoundFont preset - * @param return The program number of the preset - */ - int (*get_num)(fluid_preset_t* preset); - - /** - * Method to handle a noteon event (synthesize the instrument). - * @param preset Virtual SoundFont preset - * @param synth Synthesizer instance - * @param chan MIDI channel number of the note on event - * @param key MIDI note number (0-127) - * @param vel MIDI velocity (0-127) - * @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise - * - * This method may be called from within synthesis context and therefore - * should be as efficient as possible and not perform any operations considered - * bad for realtime audio output (memory allocations and other OS calls). - * - * Call fluid_synth_alloc_voice() for every sample that has - * to be played. fluid_synth_alloc_voice() expects a pointer to a - * #fluid_sample_t structure and returns a pointer to the opaque - * #fluid_voice_t structure. To set or increment the values of a - * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are - * finished initializing the voice call fluid_voice_start() to - * start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices - * created will be started at the same time. - */ - int (*noteon)(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel); - - /** - * Virtual SoundFont preset notify method. - * @param preset Virtual SoundFont preset - * @param reason #FLUID_PRESET_SELECTED or #FLUID_PRESET_UNSELECTED - * @param chan MIDI channel number - * @return Should return #FLUID_OK - * - * Implement this optional method if the preset needs to be notified about - * preset select and unselect events. - * - * This method may be called from within synthesis context and therefore - * should be as efficient as possible and not perform any operations considered - * bad for realtime audio output (memory allocations and other OS calls). - */ - int (*notify)(fluid_preset_t* preset, int reason, int chan); -}; - -/** - * Virtual SoundFont sample. - */ -struct _fluid_sample_t +enum fluid_sample_type { - char name[21]; /**< Sample name */ - unsigned int start; /**< Start index */ - unsigned int end; /**< End index, index of last valid sample point (contrary to SF spec) */ - unsigned int loopstart; /**< Loop start index */ - unsigned int loopend; /**< Loop end index, first point following the loop (superimposed on loopstart) */ - unsigned int samplerate; /**< Sample rate */ - int origpitch; /**< Original pitch (MIDI note number, 0-127) */ - int pitchadj; /**< Fine pitch adjustment (+/- 99 cents) */ - int sampletype; /**< Values: #FLUID_SAMPLETYPE_MONO, FLUID_SAMPLETYPE_RIGHT, FLUID_SAMPLETYPE_LEFT, FLUID_SAMPLETYPE_ROM */ - int valid; /**< Should be TRUE if sample data is valid, FALSE otherwise (in which case it will not be synthesized) */ - short* data; /**< Pointer to the sample's data */ - - int amplitude_that_reaches_noise_floor_is_valid; /**< Indicates if \a amplitude_that_reaches_noise_floor is valid (TRUE), set to FALSE initially to calculate. */ - double amplitude_that_reaches_noise_floor; /**< The amplitude at which the sample's loop will be below the noise floor. For voice off optimization, calculated automatically. */ - - unsigned int refcount; /**< Count of voices using this sample (use #fluid_sample_refcount to access this field) */ - - /** - * Implement this function to receive notification when sample is no longer used. - * @param sample Virtual SoundFont sample - * @param reason #FLUID_SAMPLE_DONE only currently - * @return Should return #FLUID_OK - */ - int (*notify)(fluid_sample_t* sample, int reason); - - void* userdata; /**< User defined data */ + FLUID_SAMPLETYPE_MONO = 0x1, /**< Used for mono samples */ + FLUID_SAMPLETYPE_RIGHT = 0x2, /**< Used for right samples of a stereo pair */ + FLUID_SAMPLETYPE_LEFT = 0x4, /**< Used for left samples of a stereo pair */ + FLUID_SAMPLETYPE_LINKED = 0x8, /**< Currently not used */ + FLUID_SAMPLETYPE_OGG_VORBIS = 0x10, /**< Used for Ogg Vorbis compressed samples @since 1.1.7 */ + FLUID_SAMPLETYPE_ROM = 0x8000 /**< Indicates ROM samples, causes sample to be ignored */ }; -#define fluid_sample_refcount(_sample) ((_sample)->refcount) /**< Get the reference count of a sample. Should only be called from within synthesis context (noteon method for example) */ +/** + * Method to load an instrument file (does not actually need to be a real file name, + * could be another type of string identifier that the \a loader understands). + * @param loader SoundFont loader + * @param filename File name or other string identifier + * @return The loaded instrument file (SoundFont) or NULL if an error occured. + */ +typedef fluid_sfont_t* (*fluid_sfloader_load_t)(fluid_sfloader_t* loader, const char* filename); + +/** + * The free method should free the memory allocated for a fluid_sfloader_t instance in + * addition to any private data. Any custom user provided cleanup function must ultimately call + * delete_fluid_sfloader() to ensure proper cleanup of the #fluid_sfloader_t struct. If no private data + * needs to be freed, setting this to delete_fluid_sfloader() is sufficient. + * @param loader SoundFont loader + */ +typedef void (*fluid_sfloader_free_t)(fluid_sfloader_t* loader); -#define FLUID_SAMPLETYPE_MONO 1 /**< Flag for #fluid_sample_t \a sampletype field for mono samples */ -#define FLUID_SAMPLETYPE_RIGHT 2 /**< Flag for #fluid_sample_t \a sampletype field for right samples of a stereo pair */ -#define FLUID_SAMPLETYPE_LEFT 4 /**< Flag for #fluid_sample_t \a sampletype field for left samples of a stereo pair */ -#define FLUID_SAMPLETYPE_LINKED 8 /**< Flag for #fluid_sample_t \a sampletype field, not used currently */ -#define FLUID_SAMPLETYPE_OGG_VORBIS 0x10 /**< Flag for #fluid_sample_t \a sampletype field for Ogg Vorbis compressed samples @since 1.1.7 */ -#define FLUID_SAMPLETYPE_ROM 0x8000 /**< Flag for #fluid_sample_t \a sampletype field, ROM sample, causes sample to be ignored */ +FLUIDSYNTH_API fluid_sfloader_t* new_fluid_sfloader(fluid_sfloader_load_t load, fluid_sfloader_free_t free); +FLUIDSYNTH_API void delete_fluid_sfloader(fluid_sfloader_t* loader); + +FLUIDSYNTH_API fluid_sfloader_t* new_fluid_defsfloader(fluid_settings_t* settings); + +/** + * Opens the file or memory indicated by \c filename in binary read mode. + * \c filename matches the string provided during the fluid_synth_sfload() call. + * + * @return returns a file handle on success, NULL otherwise + */ +typedef void * (* fluid_sfloader_callback_open_t )(const char * filename); + +/** + * Reads \c count bytes to the specified buffer \c buf. + * + * @return returns #FLUID_OK if exactly \c count bytes were successfully read, else returns #FLUID_FAILED and leaves \a buf unmodified. + */ +typedef int (* fluid_sfloader_callback_read_t )(void *buf, int count, void * handle); + +/** + * Same purpose and behaviour as fseek. + * + * @param origin either \c SEEK_SET, \c SEEK_CUR or \c SEEK_END + * + * @return returns #FLUID_OK if the seek was successfully performed while not seeking beyond a buffer or file, #FLUID_FAILED otherwise + */ +typedef int (* fluid_sfloader_callback_seek_t )(void * handle, long offset, int origin); + +/** + * Closes the handle returned by #fluid_sfloader_callback_open_t and frees used ressources. + * + * @return returns #FLUID_OK on success, #FLUID_FAILED on error + */ +typedef int (* fluid_sfloader_callback_close_t )(void * handle); + +/** @return returns current file offset or #FLUID_FAILED on error */ +typedef long (* fluid_sfloader_callback_tell_t )(void * handle); +FLUIDSYNTH_API int fluid_sfloader_set_callbacks(fluid_sfloader_t* loader, + fluid_sfloader_callback_open_t open, + fluid_sfloader_callback_read_t read, + fluid_sfloader_callback_seek_t seek, + fluid_sfloader_callback_tell_t tell, + fluid_sfloader_callback_close_t close); + +FLUIDSYNTH_API int fluid_sfloader_set_data(fluid_sfloader_t* loader, void* data); +FLUIDSYNTH_API void* fluid_sfloader_get_data(fluid_sfloader_t* loader); + + + +/** + * Method to return the name of a virtual SoundFont. + * @param sfont Virtual SoundFont + * @return The name of the virtual SoundFont. + */ +typedef const char* (*fluid_sfont_get_name_t)(fluid_sfont_t* sfont); + +/** + * Get a virtual SoundFont preset by bank and program numbers. + * @param sfont Virtual SoundFont + * @param bank MIDI bank number (0-16383) + * @param prenum MIDI preset number (0-127) + * @return Should return an allocated virtual preset or NULL if it could not + * be found. + */ +typedef fluid_preset_t* (*fluid_sfont_get_preset_t)(fluid_sfont_t* sfont, int bank, int prenum); + +/** + * Method to free a virtual SoundFont bank. Any custom user provided cleanup function must ultimately call + * delete_fluid_sfont() to ensure proper cleanup of the #fluid_sfont_t struct. If no private data + * needs to be freed, setting this to delete_fluid_sfont() is sufficient. + * @param sfont Virtual SoundFont to free. + * @return Should return 0 when it was able to free all resources or non-zero + * if some of the samples could not be freed because they are still in use, + * in which case the free will be tried again later, until success. + */ +typedef int (*fluid_sfont_free_t)(fluid_sfont_t* sfont); + + +FLUIDSYNTH_API fluid_sfont_t* new_fluid_sfont(fluid_sfont_get_name_t get_name, + fluid_sfont_get_preset_t get_preset, + fluid_sfont_free_t free); +FLUIDSYNTH_API int delete_fluid_sfont(fluid_sfont_t* sfont); + +FLUIDSYNTH_API int fluid_sfont_set_data(fluid_sfont_t* sfont, void* data); +FLUIDSYNTH_API void* fluid_sfont_get_data(fluid_sfont_t* sfont); + + +/** + * Method to get a virtual SoundFont preset name. + * @param preset Virtual SoundFont preset + * @return Should return the name of the preset. The returned string must be + * valid for the duration of the virtual preset (or the duration of the + * SoundFont, in the case of preset iteration). + */ +typedef const char* (*fluid_preset_get_name_t)(fluid_preset_t* preset); + +/** + * Method to get a virtual SoundFont preset MIDI bank number. + * @param preset Virtual SoundFont preset + * @param return The bank number of the preset + */ +typedef int (*fluid_preset_get_banknum_t)(fluid_preset_t* preset); + +/** + * Method to get a virtual SoundFont preset MIDI program number. + * @param preset Virtual SoundFont preset + * @param return The program number of the preset + */ +typedef int (*fluid_preset_get_num_t)(fluid_preset_t* preset); + +/** + * Method to handle a noteon event (synthesize the instrument). + * @param preset Virtual SoundFont preset + * @param synth Synthesizer instance + * @param chan MIDI channel number of the note on event + * @param key MIDI note number (0-127) + * @param vel MIDI velocity (0-127) + * @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise + * + * This method may be called from within synthesis context and therefore + * should be as efficient as possible and not perform any operations considered + * bad for realtime audio output (memory allocations and other OS calls). + * + * Call fluid_synth_alloc_voice() for every sample that has + * to be played. fluid_synth_alloc_voice() expects a pointer to a + * #fluid_sample_t structure and returns a pointer to the opaque + * #fluid_voice_t structure. To set or increment the values of a + * generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are + * finished initializing the voice call fluid_voice_start() to + * start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices + * created will be started at the same time. + */ +typedef int (*fluid_preset_noteon_t)(fluid_preset_t* preset, fluid_synth_t* synth, int chan, int key, int vel); + +/** + * Method to free a virtual SoundFont preset. Any custom user provided cleanup function must ultimately call + * delete_fluid_preset() to ensure proper cleanup of the #fluid_preset_t struct. If no private data + * needs to be freed, setting this to delete_fluid_preset() is sufficient. + * @param preset Virtual SoundFont preset + * @return Should return 0 + */ +typedef void (*fluid_preset_free_t)(fluid_preset_t* preset); + +FLUIDSYNTH_API fluid_preset_t* new_fluid_preset(fluid_sfont_t* parent_sfont, + fluid_preset_get_name_t get_name, + fluid_preset_get_banknum_t get_bank, + fluid_preset_get_num_t get_num, + fluid_preset_noteon_t noteon, + fluid_preset_free_t free); +FLUIDSYNTH_API void delete_fluid_preset(fluid_preset_t* preset); + +FLUIDSYNTH_API int fluid_preset_set_data(fluid_preset_t* preset, void* data); +FLUIDSYNTH_API void* fluid_preset_get_data(fluid_preset_t* preset); + + + +FLUIDSYNTH_API fluid_sample_t* new_fluid_sample(void); +FLUIDSYNTH_API void delete_fluid_sample(fluid_sample_t* sample); +FLUIDSYNTH_API size_t fluid_sample_sizeof(void); + +FLUIDSYNTH_API int fluid_sample_set_name(fluid_sample_t* sample, const char *name); +FLUIDSYNTH_API int fluid_sample_set_sound_data (fluid_sample_t* sample, + short *data, + char *data24, + unsigned int nbframes, + unsigned int sample_rate, + short copy_data); + +FLUIDSYNTH_API int fluid_sample_set_loop(fluid_sample_t* sample, unsigned int loop_start, unsigned int loop_end); +FLUIDSYNTH_API int fluid_sample_set_pitch(fluid_sample_t* sample, int root_key, int fine_tune); #ifdef __cplusplus } diff --git a/include/fluidsynth/shell.h b/include/fluidsynth/shell.h index ba0ebf4..c20b2e2 100644 --- a/include/fluidsynth/shell.h +++ b/include/fluidsynth/shell.h @@ -42,32 +42,11 @@ FLUIDSYNTH_API fluid_ostream_t fluid_get_stdout(void); FLUIDSYNTH_API char* fluid_get_userconf(char* buf, int len); FLUIDSYNTH_API char* fluid_get_sysconf(char* buf, int len); -/** - * Command handler function prototype. - * @param data User defined data - * @param ac Argument count - * @param av Array of string arguments - * @param out Output stream to send response to - * @return Should return #FLUID_OK on success, #FLUID_FAILED otherwise - */ -typedef int (*fluid_cmd_func_t)(void* data, int ac, char** av, fluid_ostream_t out); - -/** - * Shell command information structure. - */ -typedef struct { - char* name; /**< The name of the command, as typed in the shell */ - char* topic; /**< The help topic group of this command */ - fluid_cmd_func_t handler; /**< Pointer to the handler for this command */ - void* data; /**< User data passed to the handler */ - char* help; /**< A help string */ -} fluid_cmd_t; - /* The command handler */ FLUIDSYNTH_API -fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth); +fluid_cmd_handler_t* new_fluid_cmd_handler(fluid_synth_t* synth, fluid_midi_router_t* router); FLUIDSYNTH_API void delete_fluid_cmd_handler(fluid_cmd_handler_t* handler); @@ -75,11 +54,6 @@ void delete_fluid_cmd_handler(fluid_cmd_handler_t* handler); FLUIDSYNTH_API void fluid_cmd_handler_set_synth(fluid_cmd_handler_t* handler, fluid_synth_t* synth); -FLUIDSYNTH_API -int fluid_cmd_handler_register(fluid_cmd_handler_t* handler, fluid_cmd_t* cmd); - -FLUIDSYNTH_API -int fluid_cmd_handler_unregister(fluid_cmd_handler_t* handler, const char *cmd); /* Command function */ @@ -106,18 +80,10 @@ FLUIDSYNTH_API void delete_fluid_shell(fluid_shell_t* shell); /* TCP/IP server */ -/** - * Callback function which is executed for new server connections. - * @param data User defined data supplied in call to new_fluid_server() - * @param addr The IP address of the client (can be NULL) - * @return Should return a new command handler for the connection (new_fluid_cmd_handler()). - */ -typedef fluid_cmd_handler_t* (*fluid_server_newclient_func_t)(void* data, char* addr); FLUIDSYNTH_API -fluid_server_t* new_fluid_server(fluid_settings_t* settings, - fluid_server_newclient_func_t func, - void* data); +fluid_server_t* new_fluid_server(fluid_settings_t* settings, + fluid_synth_t* synth, fluid_midi_router_t* router); FLUIDSYNTH_API void delete_fluid_server(fluid_server_t* server); diff --git a/include/fluidsynth/synth.h b/include/fluidsynth/synth.h index db9a4a9..72940d4 100644 --- a/include/fluidsynth/synth.h +++ b/include/fluidsynth/synth.h @@ -45,28 +45,11 @@ extern "C" { * fluid_synth_noteon(), fluid_synth_noteoff(), ... */ -#define FLUID_SYNTH_CHANNEL_INFO_NAME_SIZE 32 /**< Length of channel info name field (including zero terminator) */ - -/** - * Channel information structure for fluid_synth_get_channel_info(). - * @since 1.1.1 - */ -struct _fluid_synth_channel_info_t -{ - int assigned : 1; /**< TRUE if a preset is assigned, FALSE otherwise */ - /* Reserved flag bits (at the least 31) */ - int sfont_id; /**< ID of parent SoundFont */ - int bank; /**< MIDI bank number (0-16383) */ - int program; /**< MIDI program number (0-127) */ - char name[FLUID_SYNTH_CHANNEL_INFO_NAME_SIZE]; /**< Channel preset name */ - char reserved[32]; /**< Reserved data for future expansion */ -}; FLUIDSYNTH_API fluid_synth_t* new_fluid_synth(fluid_settings_t* settings); -FLUIDSYNTH_API int delete_fluid_synth(fluid_synth_t* synth); +FLUIDSYNTH_API void delete_fluid_synth(fluid_synth_t* synth); FLUIDSYNTH_API fluid_settings_t* fluid_synth_get_settings(fluid_synth_t* synth); - /* MIDI channel messages */ FLUIDSYNTH_API int fluid_synth_noteon(fluid_synth_t* synth, int chan, int key, int vel); @@ -81,22 +64,20 @@ FLUIDSYNTH_API int fluid_synth_pitch_wheel_sens(fluid_synth_t* synth, int chan, FLUIDSYNTH_API int fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval); FLUIDSYNTH_API int fluid_synth_program_change(fluid_synth_t* synth, int chan, int program); FLUIDSYNTH_API int fluid_synth_channel_pressure(fluid_synth_t* synth, int chan, int val); -FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t* synth, int chan, unsigned int bank); -FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t* synth, int chan, unsigned int sfont_id); +FLUIDSYNTH_API int fluid_synth_key_pressure(fluid_synth_t* synth, int chan, int key, int val); +FLUIDSYNTH_API int fluid_synth_bank_select(fluid_synth_t* synth, int chan, int bank); +FLUIDSYNTH_API int fluid_synth_sfont_select(fluid_synth_t* synth, int chan, int sfont_id); FLUIDSYNTH_API -int fluid_synth_program_select(fluid_synth_t* synth, int chan, unsigned int sfont_id, - unsigned int bank_num, unsigned int preset_num); +int fluid_synth_program_select(fluid_synth_t* synth, int chan, int sfont_id, + int bank_num, int preset_num); FLUIDSYNTH_API int fluid_synth_program_select_by_sfont_name (fluid_synth_t* synth, int chan, - const char *sfont_name, unsigned int bank_num, - unsigned int preset_num); + const char *sfont_name, int bank_num, + int preset_num); FLUIDSYNTH_API -int fluid_synth_get_program(fluid_synth_t* synth, int chan, unsigned int* sfont_id, - unsigned int* bank_num, unsigned int* preset_num); +int fluid_synth_get_program(fluid_synth_t* synth, int chan, int* sfont_id, + int* bank_num, int* preset_num); FLUIDSYNTH_API int fluid_synth_unset_program (fluid_synth_t *synth, int chan); -FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_get_channel_info (fluid_synth_t *synth, int chan, fluid_synth_channel_info_t *info); FLUIDSYNTH_API int fluid_synth_program_reset(fluid_synth_t* synth); FLUIDSYNTH_API int fluid_synth_system_reset(fluid_synth_t* synth); @@ -127,13 +108,13 @@ FLUIDSYNTH_API int fluid_synth_stop(fluid_synth_t* synth, unsigned int id); FLUIDSYNTH_API int fluid_synth_sfload(fluid_synth_t* synth, const char* filename, int reset_presets); -FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t* synth, unsigned int id); -FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t* synth, unsigned int id, int reset_presets); +FLUIDSYNTH_API int fluid_synth_sfreload(fluid_synth_t* synth, int id); +FLUIDSYNTH_API int fluid_synth_sfunload(fluid_synth_t* synth, int id, int reset_presets); FLUIDSYNTH_API int fluid_synth_add_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont); -FLUIDSYNTH_API void fluid_synth_remove_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont); +FLUIDSYNTH_API int fluid_synth_remove_sfont(fluid_synth_t* synth, fluid_sfont_t* sfont); FLUIDSYNTH_API int fluid_synth_sfcount(fluid_synth_t* synth); FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont(fluid_synth_t* synth, unsigned int num); -FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id); +FLUIDSYNTH_API fluid_sfont_t* fluid_synth_get_sfont_by_id(fluid_synth_t* synth, int id); FLUIDSYNTH_API fluid_sfont_t *fluid_synth_get_sfont_by_name (fluid_synth_t* synth, const char *name); FLUIDSYNTH_API int fluid_synth_set_bank_offset(fluid_synth_t* synth, int sfont_id, int offset); @@ -142,19 +123,20 @@ FLUIDSYNTH_API int fluid_synth_get_bank_offset(fluid_synth_t* synth, int sfont_i /* Reverb */ -FLUIDSYNTH_API void fluid_synth_set_reverb(fluid_synth_t* synth, double roomsize, - double damping, double width, double level); + +FLUIDSYNTH_API int fluid_synth_set_reverb(fluid_synth_t* synth, double roomsize, + double damping, double width, double level); +FLUIDSYNTH_API int fluid_synth_set_reverb_roomsize(fluid_synth_t* synth, double roomsize); +FLUIDSYNTH_API int fluid_synth_set_reverb_damp(fluid_synth_t* synth, double damping); +FLUIDSYNTH_API int fluid_synth_set_reverb_width(fluid_synth_t* synth, double width); +FLUIDSYNTH_API int fluid_synth_set_reverb_level(fluid_synth_t* synth, double level); + FLUIDSYNTH_API void fluid_synth_set_reverb_on(fluid_synth_t* synth, int on); FLUIDSYNTH_API double fluid_synth_get_reverb_roomsize(fluid_synth_t* synth); FLUIDSYNTH_API double fluid_synth_get_reverb_damp(fluid_synth_t* synth); FLUIDSYNTH_API double fluid_synth_get_reverb_level(fluid_synth_t* synth); FLUIDSYNTH_API double fluid_synth_get_reverb_width(fluid_synth_t* synth); -#define FLUID_REVERB_DEFAULT_ROOMSIZE 0.2f /**< Default reverb room size */ -#define FLUID_REVERB_DEFAULT_DAMP 0.0f /**< Default reverb damping */ -#define FLUID_REVERB_DEFAULT_WIDTH 0.5f /**< Default reverb width */ -#define FLUID_REVERB_DEFAULT_LEVEL 0.9f /**< Default reverb level */ - /* Chorus */ @@ -166,21 +148,21 @@ enum fluid_chorus_mod { FLUID_CHORUS_MOD_TRIANGLE = 1 /**< Triangle wave chorus modulation */ }; -FLUIDSYNTH_API void fluid_synth_set_chorus(fluid_synth_t* synth, int nr, double level, +FLUIDSYNTH_API int fluid_synth_set_chorus(fluid_synth_t* synth, int nr, double level, double speed, double depth_ms, int type); +FLUIDSYNTH_API int fluid_synth_set_chorus_nr(fluid_synth_t* synth, int nr); +FLUIDSYNTH_API int fluid_synth_set_chorus_level(fluid_synth_t* synth, double level); +FLUIDSYNTH_API int fluid_synth_set_chorus_speed(fluid_synth_t* synth, double speed); +FLUIDSYNTH_API int fluid_synth_set_chorus_depth(fluid_synth_t* synth, double depth_ms); +FLUIDSYNTH_API int fluid_synth_set_chorus_type(fluid_synth_t* synth, int type); + FLUIDSYNTH_API void fluid_synth_set_chorus_on(fluid_synth_t* synth, int on); FLUIDSYNTH_API int fluid_synth_get_chorus_nr(fluid_synth_t* synth); FLUIDSYNTH_API double fluid_synth_get_chorus_level(fluid_synth_t* synth); -FLUIDSYNTH_API double fluid_synth_get_chorus_speed_Hz(fluid_synth_t* synth); -FLUIDSYNTH_API double fluid_synth_get_chorus_depth_ms(fluid_synth_t* synth); +FLUIDSYNTH_API double fluid_synth_get_chorus_speed(fluid_synth_t* synth); +FLUIDSYNTH_API double fluid_synth_get_chorus_depth(fluid_synth_t* synth); FLUIDSYNTH_API int fluid_synth_get_chorus_type(fluid_synth_t* synth); /* see fluid_chorus_mod */ -#define FLUID_CHORUS_DEFAULT_N 3 /**< Default chorus voice count */ -#define FLUID_CHORUS_DEFAULT_LEVEL 2.0f /**< Default chorus level */ -#define FLUID_CHORUS_DEFAULT_SPEED 0.3f /**< Default chorus speed */ -#define FLUID_CHORUS_DEFAULT_DEPTH 8.0f /**< Default chorus depth */ -#define FLUID_CHORUS_DEFAULT_TYPE FLUID_CHORUS_MOD_SINE /**< Default chorus waveform type */ - /* Audio and MIDI channels */ @@ -210,54 +192,34 @@ enum fluid_interp { FLUID_INTERP_NONE = 0, /**< No interpolation: Fastest, but questionable audio quality */ FLUID_INTERP_LINEAR = 1, /**< Straight-line interpolation: A bit slower, reasonable audio quality */ FLUID_INTERP_4THORDER = 4, /**< Fourth-order interpolation, good quality, the default */ - FLUID_INTERP_7THORDER = 7 /**< Seventh-order interpolation */ + FLUID_INTERP_7THORDER = 7, /**< Seventh-order interpolation */ + + FLUID_INTERP_DEFAULT = FLUID_INTERP_4THORDER, /**< Default interpolation method */ + FLUID_INTERP_HIGHEST = FLUID_INTERP_7THORDER, /**< Highest interpolation method */ }; -#define FLUID_INTERP_DEFAULT FLUID_INTERP_4THORDER /**< Default interpolation method from #fluid_interp. */ -#define FLUID_INTERP_HIGHEST FLUID_INTERP_7THORDER /**< Highest interpolation method from #fluid_interp. */ - - /* Generator interface */ -FLUIDSYNTH_API -int fluid_synth_set_gen(fluid_synth_t* synth, int chan, int param, float value); -FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_set_gen2 (fluid_synth_t* synth, int chan, - int param, float value, - int absolute, int normalized); +FLUIDSYNTH_API int fluid_synth_set_gen (fluid_synth_t* synth, int chan, + int param, float value); FLUIDSYNTH_API float fluid_synth_get_gen(fluid_synth_t* synth, int chan, int param); /* Tuning */ -FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_create_key_tuning(fluid_synth_t* synth, int bank, int prog, - const char* name, const double* pitch); FLUIDSYNTH_API int fluid_synth_activate_key_tuning(fluid_synth_t* synth, int bank, int prog, const char* name, const double* pitch, int apply); -FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_create_octave_tuning(fluid_synth_t* synth, int bank, int prog, - const char* name, const double* pitch); FLUIDSYNTH_API int fluid_synth_activate_octave_tuning(fluid_synth_t* synth, int bank, int prog, const char* name, const double* pitch, int apply); FLUIDSYNTH_API int fluid_synth_tune_notes(fluid_synth_t* synth, int bank, int prog, int len, const int *keys, const double* pitch, int apply); -FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_select_tuning(fluid_synth_t* synth, int chan, int bank, int prog); FLUIDSYNTH_API int fluid_synth_activate_tuning(fluid_synth_t* synth, int chan, int bank, int prog, int apply); FLUIDSYNTH_API -FLUID_DEPRECATED -int fluid_synth_reset_tuning(fluid_synth_t* synth, int chan); -FLUIDSYNTH_API int fluid_synth_deactivate_tuning(fluid_synth_t* synth, int chan, int apply); FLUIDSYNTH_API void fluid_synth_tuning_iteration_start(fluid_synth_t* synth); FLUIDSYNTH_API @@ -268,7 +230,21 @@ FLUIDSYNTH_API int fluid_synth_tuning_dump(fluid_synth_t* synth, int bank, int p /* Misc */ FLUIDSYNTH_API double fluid_synth_get_cpu_load(fluid_synth_t* synth); -FLUIDSYNTH_API char* fluid_synth_error(fluid_synth_t* synth); +FLUIDSYNTH_API const char* fluid_synth_error(fluid_synth_t* synth); + + +/* Default modulators */ + +/** + * Enum used with fluid_synth_add_default_mod() to specify how to handle duplicate modulators. + */ +enum fluid_synth_add_mod { + FLUID_SYNTH_OVERWRITE, /**< Overwrite any existing matching modulator */ + FLUID_SYNTH_ADD, /**< Add (sum) modulator amounts */ +}; + +FLUIDSYNTH_API int fluid_synth_add_default_mod(fluid_synth_t* synth, fluid_mod_t* mod, int mode); +FLUIDSYNTH_API int fluid_synth_remove_default_mod(fluid_synth_t* synth, const fluid_mod_t* mod); /* @@ -289,36 +265,124 @@ FLUIDSYNTH_API int fluid_synth_nwrite_float(fluid_synth_t* synth, int len, float** left, float** right, float** fx_left, float** fx_right); FLUIDSYNTH_API int fluid_synth_process(fluid_synth_t* synth, int len, - int nin, float** in, - int nout, float** out); + int nfx, float* fx[], + int nout, float* out[]); -/** - * Type definition of the synthesizer's audio callback function. - * @param synth FluidSynth instance - * @param len Count of audio frames to synthesize - * @param out1 Array to store left channel of audio to - * @param loff Offset index in 'out1' for first sample - * @param lincr Increment between samples stored to 'out1' - * @param out2 Array to store right channel of audio to - * @param roff Offset index in 'out2' for first sample - * @param rincr Increment between samples stored to 'out2' - */ -typedef int (*fluid_audio_callback_t)(fluid_synth_t* synth, int len, - void* out1, int loff, int lincr, - void* out2, int roff, int rincr); /* Synthesizer's interface to handle SoundFont loaders */ FLUIDSYNTH_API void fluid_synth_add_sfloader(fluid_synth_t* synth, fluid_sfloader_t* loader); -FLUIDSYNTH_API fluid_voice_t* fluid_synth_alloc_voice(fluid_synth_t* synth, fluid_sample_t* sample, +FLUIDSYNTH_API fluid_voice_t* fluid_synth_alloc_voice(fluid_synth_t* synth, + fluid_sample_t* sample, int channum, int key, int vel); FLUIDSYNTH_API void fluid_synth_start_voice(fluid_synth_t* synth, fluid_voice_t* voice); FLUIDSYNTH_API void fluid_synth_get_voicelist(fluid_synth_t* synth, fluid_voice_t* buf[], int bufsize, int ID); FLUIDSYNTH_API int fluid_synth_handle_midi_event(void* data, fluid_midi_event_t* event); -FLUIDSYNTH_API -FLUID_DEPRECATED -void fluid_synth_set_midi_router(fluid_synth_t* synth, fluid_midi_router_t* router); + +/** + * Specifies the type of filter to use for the custom IIR filter + */ +enum fluid_iir_filter_type { + FLUID_IIR_DISABLED = 0, /**< Custom IIR filter is not operating */ + FLUID_IIR_LOWPASS, /**< Custom IIR filter is operating as low-pass filter */ + FLUID_IIR_HIGHPASS, /**< Custom IIR filter is operating as high-pass filter */ + FLUID_IIR_LAST /**< @internal Value defines the count of filter types (#fluid_iir_filter_type) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +}; + +/** + * Specifies optional settings to use for the custom IIR filter + */ +enum fluid_iir_filter_flags { + FLUID_IIR_Q_LINEAR = 1 << 0, /**< The Soundfont spec requires the filter Q to be interpreted in dB. If this flag is set the filter Q is instead assumed to be in a linear range */ + FLUID_IIR_Q_ZERO_OFF = 1 << 1, /**< If this flag the filter is switched off if Q == 0 (prior to any transformation) */ + FLUID_IIR_NO_GAIN_AMP = 1 << 2 /**< The Soundfont spec requires to correct the gain of the filter depending on the filter's Q. If this flag is set the filter gain will not be corrected. */ +}; + +FLUIDSYNTH_API int fluid_synth_set_custom_filter(fluid_synth_t*, int type, int flags); + + +/* LADSPA */ + +FLUIDSYNTH_API fluid_ladspa_fx_t *fluid_synth_get_ladspa_fx(fluid_synth_t *synth); + + +/* API: Poly mono mode */ + +/** Interface to poly/mono mode variables + * + * Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3) + */ +enum fluid_channel_mode_flags +{ + FLUID_CHANNEL_POLY_OFF = 0x01, /**< if flag is set, the basic channel is in mono on state, if not set poly is on */ + FLUID_CHANNEL_OMNI_OFF = 0x02, /**< if flag is set, the basic channel is in omni off state, if not set omni is on */ +}; + +/** Indicates the breath mode a channel is set to */ +enum fluid_channel_breath_flags +{ + FLUID_CHANNEL_BREATH_POLY = 0x10, /**< when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator */ + FLUID_CHANNEL_BREATH_MONO = 0x20, /**< when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator */ + FLUID_CHANNEL_BREATH_SYNC = 0x40, /**< when channel is mono, this flag indicates that the breath controler(MSB)triggers noteon/noteoff on the running note */ +}; + +/** Indicates the mode a basic channel is set to */ +enum fluid_basic_channel_modes +{ + FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< Mask Poly and Omni bits of #fluid_channel_mode_flags, usually only used internally */ + FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 0 */ + FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 1 */ + FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 2 */ + FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF), /**< corresponds to MIDI mode 3 */ + FLUID_CHANNEL_MODE_LAST /**< @internal Value defines the count of basic channel modes (#fluid_basic_channel_modes) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +}; + +FLUIDSYNTH_API int fluid_synth_reset_basic_channel(fluid_synth_t* synth, int chan); + +FLUIDSYNTH_API int fluid_synth_get_basic_channel(fluid_synth_t* synth, int chan, + int *basic_chan_out, + int *mode_chan_out, + int *basic_val_out ); +FLUIDSYNTH_API int fluid_synth_set_basic_channel(fluid_synth_t* synth, int chan, int mode, int val); + +/** Interface to mono legato mode + * + * Indicates the legato mode a channel is set to + * n1,n2,n3,.. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note. */ +enum fluid_channel_legato_mode +{ + FLUID_CHANNEL_LEGATO_MODE_RETRIGGER, /**< Mode 0 - Release previous note, start a new note */ + FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER, /**< Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any */ + FLUID_CHANNEL_LEGATO_MODE_LAST /**< @internal Value defines the count of legato modes (#fluid_channel_legato_mode) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +}; + +FLUIDSYNTH_API int fluid_synth_set_legato_mode(fluid_synth_t* synth, int chan, int legatomode); +FLUIDSYNTH_API int fluid_synth_get_legato_mode(fluid_synth_t* synth, int chan, int *legatomode); + +/** Interface to portamento mode + * + * Indicates the portamento mode a channel is set to + */ +enum fluid_channel_portamento_mode +{ + FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE, /**< Mode 0 - Portamento on each note (staccato or legato) */ + FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY, /**< Mode 1 - Portamento only on legato note */ + FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY, /**< Mode 2 - Portamento only on staccato note */ + FLUID_CHANNEL_PORTAMENTO_MODE_LAST /**< @internal Value defines the count of portamento modes (#fluid_channel_portamento_mode) @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */ +}; + +FLUIDSYNTH_API int fluid_synth_set_portamento_mode(fluid_synth_t* synth, + int chan, int portamentomode); +FLUIDSYNTH_API int fluid_synth_get_portamento_mode(fluid_synth_t* synth, + int chan, int * portamentomode); + +/* Interface to breath mode */ +FLUIDSYNTH_API int fluid_synth_set_breath_mode(fluid_synth_t* synth, + int chan, int breathmode); +FLUIDSYNTH_API int fluid_synth_get_breath_mode(fluid_synth_t* synth, + int chan, int *breathmode); + #ifdef __cplusplus } diff --git a/include/fluidsynth/types.h b/include/fluidsynth/types.h index ebe40a8..dd5bfa8 100644 --- a/include/fluidsynth/types.h +++ b/include/fluidsynth/types.h @@ -35,7 +35,6 @@ extern "C" { typedef struct _fluid_hashtable_t fluid_settings_t; /**< Configuration settings instance */ typedef struct _fluid_synth_t fluid_synth_t; /**< Synthesizer instance */ -typedef struct _fluid_synth_channel_info_t fluid_synth_channel_info_t; /**< SoundFont channel info */ typedef struct _fluid_voice_t fluid_voice_t; /**< Synthesis voice instance */ typedef struct _fluid_sfloader_t fluid_sfloader_t; /**< SoundFont loader plugin */ typedef struct _fluid_sfont_t fluid_sfont_t; /**< SoundFont */ @@ -49,13 +48,16 @@ typedef struct _fluid_midi_event_t fluid_midi_event_t; /**< MIDI event typedef struct _fluid_midi_driver_t fluid_midi_driver_t; /**< MIDI driver instance */ typedef struct _fluid_midi_router_t fluid_midi_router_t; /**< MIDI router instance */ typedef struct _fluid_midi_router_rule_t fluid_midi_router_rule_t; /**< MIDI router rule */ -typedef struct _fluid_hashtable_t fluid_cmd_handler_t; /**< Command handler */ +typedef struct _fluid_hashtable_t fluid_cmd_hash_t; /**< Command handler hash table */ typedef struct _fluid_shell_t fluid_shell_t; /**< Command shell */ typedef struct _fluid_server_t fluid_server_t; /**< TCP/IP shell server instance */ typedef struct _fluid_event_t fluid_event_t; /**< Sequencer event */ typedef struct _fluid_sequencer_t fluid_sequencer_t; /**< Sequencer instance */ typedef struct _fluid_ramsfont_t fluid_ramsfont_t; /**< RAM SoundFont */ typedef struct _fluid_rampreset_t fluid_rampreset_t; /**< RAM SoundFont preset */ +typedef struct _fluid_cmd_handler_t fluid_cmd_handler_t; /**< Shell Command Handler */ +typedef struct _fluid_ladspa_fx_t fluid_ladspa_fx_t; /**< LADSPA effects instance */ +typedef struct _fluid_file_callbacks_t fluid_file_callbacks_t; /**< Callback struct to perform custom file loading of soundfonts */ typedef int fluid_istream_t; /**< Input stream descriptor */ typedef int fluid_ostream_t; /**< Output stream descriptor */ diff --git a/include/fluidsynth/version.h b/include/fluidsynth/version.h index 8a199c9..cf234c9 100644 --- a/include/fluidsynth/version.h +++ b/include/fluidsynth/version.h @@ -31,10 +31,10 @@ extern "C" { * @brief Library version functions and defines */ -#define FLUIDSYNTH_VERSION "1.1.11" /**< String constant of libfluidsynth version. */ -#define FLUIDSYNTH_VERSION_MAJOR 1 /**< libfluidsynth major version integer constant. */ -#define FLUIDSYNTH_VERSION_MINOR 1 /**< libfluidsynth minor version integer constant. */ -#define FLUIDSYNTH_VERSION_MICRO 11 /**< libfluidsynth micro version integer constant. */ +#define FLUIDSYNTH_VERSION "2.0.0" /**< String constant of libfluidsynth version. */ +#define FLUIDSYNTH_VERSION_MAJOR 2 /**< libfluidsynth major version integer constant. */ +#define FLUIDSYNTH_VERSION_MINOR 0 /**< libfluidsynth minor version integer constant. */ +#define FLUIDSYNTH_VERSION_MICRO 0 /**< libfluidsynth micro version integer constant. */ FLUIDSYNTH_API void fluid_version(int *major, int *minor, int *micro); FLUIDSYNTH_API char* fluid_version_str(void); diff --git a/include/fluidsynth/voice.h b/include/fluidsynth/voice.h index f28e1dc..ed3f869 100644 --- a/include/fluidsynth/voice.h +++ b/include/fluidsynth/voice.h @@ -36,8 +36,6 @@ extern "C" { */ -FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t* voice, int gen); - /** * Enum used with fluid_voice_add_mod() to specify how to handle duplicate modulators. */ @@ -48,21 +46,22 @@ enum fluid_voice_add_mod { }; FLUIDSYNTH_API void fluid_voice_add_mod(fluid_voice_t* voice, fluid_mod_t* mod, int mode); -FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t* voice, int gen, float val); FLUIDSYNTH_API float fluid_voice_gen_get(fluid_voice_t* voice, int gen); +FLUIDSYNTH_API void fluid_voice_gen_set(fluid_voice_t* voice, int gen, float val); FLUIDSYNTH_API void fluid_voice_gen_incr(fluid_voice_t* voice, int gen, float val); FLUIDSYNTH_API unsigned int fluid_voice_get_id(const fluid_voice_t* voice); +FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t* voice); +FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t* voice); +FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t* voice); +FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t* voice); +FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t* voice); FLUIDSYNTH_API int fluid_voice_is_playing(const fluid_voice_t* voice); FLUIDSYNTH_API int fluid_voice_is_on(const fluid_voice_t* voice); FLUIDSYNTH_API int fluid_voice_is_sustained(const fluid_voice_t* voice); FLUIDSYNTH_API int fluid_voice_is_sostenuto(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_get_channel(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_get_actual_key(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_get_key(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_get_actual_velocity(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_get_velocity(const fluid_voice_t* voice); -FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t* s); +FLUIDSYNTH_API int fluid_voice_optimize_sample(fluid_sample_t* s); +FLUIDSYNTH_API void fluid_voice_update_param(fluid_voice_t* voice, int gen); #ifdef __cplusplus