diff --git a/fluidsynth/ChangeLog b/fluidsynth/ChangeLog index a446ba75..bcffbcef 100644 --- a/fluidsynth/ChangeLog +++ b/fluidsynth/ChangeLog @@ -1,3 +1,10 @@ + +2004-02-28 Peter Hanappe + + * src/fluid_synth.c: Added fluid_synth_program_select2() and + fluid_synth_get_sfont_by_name() in fluid_synth.c. These functions + are not in the public API, yet. + 2004-02-25 Peter Hanappe * src/fluid_voice.c: Fixed bug in volume envelope (in @@ -177,7 +184,7 @@ is responsible to call fluid_voice_optimize_sample (if it doesn't, the turnoff optimization is simply disabled). -2003-04-029 Antoine Schmitt +1999-11-30 Antoine Schmitt * src/fluid_defsfont.c: inst_zone lokey is now properly inialized to 0 (it was not, leading to random lost noteons depending on memory @@ -554,11 +561,11 @@ suggestion for the Makefile.am to fix the problems with automake 1.6 -2002-07-13 Tim Goetze +1999-11-30 Tim Goetze * src/iiwu_synth.c (iiwu_synth_alloc_voice): New algorithm for voice allocation, when all voice processes are in use -2002-07-13 Markus Nentwig +1999-11-30 Markus Nentwig * src/iiwu_synth.c (iiwu_synth_alloc_voice): Applied above patch, 2002-07-08 Markus Nentwig @@ -573,7 +580,7 @@ rebuilt with the latest automake 1.6. You cannot use substitution for *_SOURCES in Makefile.am. This fixes this problem. -2002-06-29 Markus Nentwig +1999-11-30 Markus Nentwig * src/iiwusynth.h: Added documentation, removed GEN_CHANGED (it was unused). diff --git a/fluidsynth/TODO b/fluidsynth/TODO index bfdbfc9f..18429cbb 100644 --- a/fluidsynth/TODO +++ b/fluidsynth/TODO @@ -12,6 +12,30 @@ already been done. - Josh Green 2003-08-25 - When specifying -i -s (no console and TCP server) log to TCP clients with easier parsable messages ("warning:", "error:", etc) +- GM soundfont? +- MacOS X MidiCore component +- Windows DirectMusic component +- Multi-channel audio output + +- fluid_synth_program_select() with name of soundfont instead of font_id +- set loop on/off on a sample (1 - with name sample, 2 - name sf and name preset) +- add function to get initial soundfont generator value +- add function to set generator value in absolute value (offset with + initial soundfont generator value) +- add function to set absolute and relative generator value on a scale + of 0 to 1 + + + + +inst zone +- attack (set to +- scale tune +- modLfoToPitch + +- Write documention on tuning + + Synthesis related ----------------- diff --git a/fluidsynth/src/fluid_synth.c b/fluidsynth/src/fluid_synth.c index f8be8726..403b8601 100644 --- a/fluidsynth/src/fluid_synth.c +++ b/fluidsynth/src/fluid_synth.c @@ -29,6 +29,25 @@ fluid_sfloader_t* new_fluid_defsfloader(void); +/************************************************************************ + * + * These functions were added after the v1.0 API freeze. They are not + * in synth.h. They should be added as soon as a new development + * version is started. + * + ************************************************************************/ + +int fluid_synth_program_select2(fluid_synth_t* synth, + int chan, + char* sfont_name, + unsigned int bank_num, + unsigned int preset_num); + +fluid_sfont_t* fluid_synth_get_sfont_by_name(fluid_synth_t* synth, char *name); + +int fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval); + + /*************************************************************** * * GLOBAL @@ -1041,7 +1060,7 @@ fluid_synth_pitch_wheel_sens(fluid_synth_t* synth, int chan, int val) * So its API is not in the synth.h file. It should be added in some later * version of fluidsynth. Maybe v2.0 ? -- Antoine Schmitt May 2003 */ -/******************* + int fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval) { @@ -1057,7 +1076,6 @@ fluid_synth_get_pitch_wheel_sens(fluid_synth_t* synth, int chan, int* pval) return FLUID_OK; } -************/ /* * fluid_synth_get_preset @@ -1081,6 +1099,27 @@ fluid_synth_get_preset(fluid_synth_t* synth, unsigned int sfontnum, return NULL; } +/* + * fluid_synth_get_preset2 + */ +fluid_preset_t* +fluid_synth_get_preset2(fluid_synth_t* synth, char* sfont_name, + unsigned int banknum, unsigned int prognum) +{ + fluid_preset_t* preset = NULL; + fluid_sfont_t* sfont = NULL; + + sfont = fluid_synth_get_sfont_by_name(synth, sfont_name); + + if (sfont != NULL) { + preset = fluid_sfont_get_preset(sfont, banknum, prognum); + if (preset != NULL) { + return preset; + } + } + return NULL; +} + fluid_preset_t* fluid_synth_find_preset(fluid_synth_t* synth, unsigned int banknum, unsigned int prognum) @@ -1238,6 +1277,49 @@ int fluid_synth_program_select(fluid_synth_t* synth, return FLUID_OK; } +/* + * fluid_synth_program_select2 + */ +int fluid_synth_program_select2(fluid_synth_t* synth, + int chan, + char* sfont_name, + unsigned int bank_num, + unsigned int preset_num) +{ + fluid_preset_t* preset = NULL; + fluid_channel_t* channel; + fluid_sfont_t* sfont = NULL; + + if ((chan < 0) || (chan >= synth->midi_channels)) { + FLUID_LOG(FLUID_ERR, "Channel number out of range (chan=%d)", chan); + return FLUID_FAILED; + } + channel = synth->channel[chan]; + + sfont = fluid_synth_get_sfont_by_name(synth, sfont_name); + if (sfont == NULL) { + FLUID_LOG(FLUID_ERR, "Could not find SoundFont %s", sfont_name); + return FLUID_FAILED; + } + + preset = fluid_sfont_get_preset(sfont, bank_num, preset_num); + if (preset == NULL) { + FLUID_LOG(FLUID_ERR, + "There is no preset with bank number %d and preset number %d in SoundFont %s", + bank_num, preset_num, sfont_name); + return FLUID_FAILED; + } + + /* inform the channel of the new bank and program number */ + fluid_channel_set_sfontnum(channel, fluid_sfont_get_id(sfont)); + fluid_channel_set_banknum(channel, bank_num); + fluid_channel_set_prognum(channel, preset_num); + + fluid_channel_set_preset(channel, preset); + + return FLUID_OK; +} + /* * fluid_synth_update_presets */ @@ -2202,6 +2284,24 @@ fluid_sfont_t* fluid_synth_get_sfont_by_id(fluid_synth_t* synth, unsigned int id return NULL; } +/* fluid_synth_get_sfont_by_name + * + */ +fluid_sfont_t* fluid_synth_get_sfont_by_name(fluid_synth_t* synth, char *name) +{ + fluid_list_t* list = synth->sfont; + fluid_sfont_t* sfont; + + while (list) { + sfont = (fluid_sfont_t*) fluid_list_get(list); + if (FLUID_STRCMP(fluid_sfont_get_name(sfont), name) == 0) { + return sfont; + } + list = fluid_list_next(list); + } + return NULL; +} + /* * fluid_synth_get_channel_preset */