A bunch of patches and fixes from FluidSynth users.

This commit is contained in:
Element Green 2003-08-30 00:55:23 +00:00
parent 36386371a7
commit c80e751980
7 changed files with 64 additions and 36 deletions

View file

@ -1,3 +1,21 @@
2003-08-29 Josh Green <jgreen@users.sourceforge.net>
* src/fluid_sys.c: Patch from Eric Van Buggenhaut to make i386 asm
code not compile for all non-i386 archs rather than just DARWIN.
* src/fluidsynth_priv.h: Patch from Sergey Pavlishin to fix
FLUID_REALLOC macro.
* src/fluid_cmd.c: Ken Ellinwood's patch to add -verbose to "channels"
command, and print settings values with 3 decimal places.
* src/fluid_defsfont.c (fluid_defsfont_sfont_get_preset): Ken
Ellinwood's patch to initialize sfont field of preset.
* src/fluid_ramsfont.c (fluid_ramsfont_sfont_get_preset): Ken
Ellinwood's patch to initialize sfont field of preset.
* src/fluid_midi.c (fluid_midi_file_read_event): Fixed a crash bug with
zero length MIDI meta events that was pointed out by Sergey Pavlishin.
(delete_fluid_midi_event): Fixed a stack overflow problem pointed out
by Sergey Pavlishin that was caused by recursively deleting MIDI
event linked list, now just using a while loop.
2003-08-25 Josh Green <jgreen@users.sourceforge.net> 2003-08-25 Josh Green <jgreen@users.sourceforge.net>
* src/fluidsynth.c: MIDI channels switch should be -K not -L as was * src/fluidsynth.c: MIDI channels switch should be -K not -L as was

View file

@ -73,7 +73,7 @@ fluid_cmd_t fluid_commands[] = {
{ "inst", "general", (fluid_cmd_func_t) fluid_handle_inst, NULL, { "inst", "general", (fluid_cmd_func_t) fluid_handle_inst, NULL,
"inst font Print out the available instruments for the font" }, "inst font Print out the available instruments for the font" },
{ "channels", "general", (fluid_cmd_func_t) fluid_handle_channels, NULL, { "channels", "general", (fluid_cmd_func_t) fluid_handle_channels, NULL,
"channels Print out preset of all channels" }, "channels [-verbose] Print out preset of all channels" },
{ "interp", "general", (fluid_cmd_func_t) fluid_handle_interp, NULL, { "interp", "general", (fluid_cmd_func_t) fluid_handle_interp, NULL,
"interp num Choose interpolation method for all channels" }, "interp num Choose interpolation method for all channels" },
{ "interpc", "general", (fluid_cmd_func_t) fluid_handle_interpc, NULL, { "interpc", "general", (fluid_cmd_func_t) fluid_handle_interpc, NULL,
@ -480,15 +480,19 @@ fluid_handle_channels(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t o
{ {
int i; int i;
fluid_preset_t* preset; fluid_preset_t* preset;
int verbose = 0;
if (ac > 0 && strcmp( av[0], "-verbose") == 0) verbose = 1;
for (i = 0; i < fluid_synth_count_midi_channels(synth); i++) { for (i = 0; i < fluid_synth_count_midi_channels(synth); i++) {
preset = fluid_synth_get_channel_preset(synth, i); preset = fluid_synth_get_channel_preset(synth, i);
if (preset != NULL) { if (preset == NULL) fluid_ostream_printf(out, "chan %d, no preset\n", i);
fluid_ostream_printf(out, "chan %d, %s\n", else if (!verbose) fluid_ostream_printf(out, "chan %d, %s\n", i, fluid_preset_get_name(preset));
i, fluid_preset_get_name(preset)); else fluid_ostream_printf(out, "chan %d, sfont %d, bank %d, preset %d, %s\n", i,
} else { fluid_sfont_get_id( preset->sfont),
fluid_ostream_printf(out, "chan %d, no preset\n", i); fluid_preset_get_banknum(preset),
} fluid_preset_get_num(preset),
fluid_preset_get_name(preset));
} }
return 0; return 0;
} }
@ -1180,7 +1184,7 @@ fluid_handle_get(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out)
case FLUID_NUM_TYPE: { case FLUID_NUM_TYPE: {
double value; double value;
fluid_synth_getnum(synth, av[0], &value); fluid_synth_getnum(synth, av[0], &value);
fluid_ostream_printf(out, "%f", value); fluid_ostream_printf(out, "%.3f", value);
break; break;
} }
@ -1237,7 +1241,7 @@ static void fluid_handle_settings_iter2(void* data, char* name, int type)
case FLUID_NUM_TYPE: { case FLUID_NUM_TYPE: {
double value; double value;
fluid_synth_getnum(d->synth, name, &value); fluid_synth_getnum(d->synth, name, &value);
fluid_ostream_printf(d->out, "%f\n", value); fluid_ostream_printf(d->out, "%.3f\n", value);
break; break;
} }
@ -1311,7 +1315,7 @@ fluid_handle_info(fluid_synth_t* synth, int ac, char** av, fluid_ostream_t out)
fluid_settings_getnum(settings, av[0], &value); fluid_settings_getnum(settings, av[0], &value);
fluid_ostream_printf(out, "%s:\n", av[0]); fluid_ostream_printf(out, "%s:\n", av[0]);
fluid_ostream_printf(out, "Type: number\n"); fluid_ostream_printf(out, "Type: number\n");
fluid_ostream_printf(out, "Value: %f\n", value); fluid_ostream_printf(out, "Value: %.3f\n", value);
fluid_ostream_printf(out, "Minimum value: %.3f\n", min); fluid_ostream_printf(out, "Minimum value: %.3f\n", min);
fluid_ostream_printf(out, "Maximum value: %.3f\n", max); fluid_ostream_printf(out, "Maximum value: %.3f\n", max);
fluid_ostream_printf(out, "Default value: %.3f\n", fluid_ostream_printf(out, "Default value: %.3f\n",

View file

@ -127,6 +127,7 @@ fluid_defsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned int bank, unsigne
return NULL; return NULL;
} }
preset->sfont = sfont;
preset->data = defpreset; preset->data = defpreset;
preset->free = fluid_defpreset_preset_delete; preset->free = fluid_defpreset_preset_delete;
preset->get_name = fluid_defpreset_preset_get_name; preset->get_name = fluid_defpreset_preset_get_name;

View file

@ -442,8 +442,6 @@ int fluid_midi_file_read_event(fluid_midi_file* mf, fluid_track_t* track)
return FLUID_FAILED; return FLUID_FAILED;
} }
if (mf->varlen) {
if (mf->varlen < 255) { if (mf->varlen < 255) {
metadata = &static_buf[0]; metadata = &static_buf[0];
} else { } else {
@ -457,6 +455,8 @@ int fluid_midi_file_read_event(fluid_midi_file* mf, fluid_track_t* track)
} }
/* read the data */ /* read the data */
if (mf->varlen)
{
if (fluid_midi_file_read(mf, metadata, mf->varlen) != FLUID_OK) { if (fluid_midi_file_read(mf, metadata, mf->varlen) != FLUID_OK) {
if (dyn_buf) { if (dyn_buf) {
FLUID_FREE(dyn_buf); FLUID_FREE(dyn_buf);
@ -684,10 +684,14 @@ fluid_midi_event_t* new_fluid_midi_event()
*/ */
int delete_fluid_midi_event(fluid_midi_event_t* evt) int delete_fluid_midi_event(fluid_midi_event_t* evt)
{ {
if (evt->next != NULL) { fluid_midi_event_t *temp;
delete_fluid_midi_event(evt->next);
} while (evt)
{
temp = evt->next;
FLUID_FREE(evt); FLUID_FREE(evt);
evt = temp;
}
return FLUID_OK; return FLUID_OK;
} }

View file

@ -115,6 +115,7 @@ fluid_preset_t* fluid_ramsfont_sfont_get_preset(fluid_sfont_t* sfont, unsigned i
return NULL; return NULL;
} }
preset->sfont = sfont;
preset->data = rampreset; preset->data = rampreset;
preset->free = fluid_rampreset_preset_delete; preset->free = fluid_rampreset_preset_delete;
preset->get_name = fluid_rampreset_preset_get_name; preset->get_name = fluid_rampreset_preset_get_name;

View file

@ -704,7 +704,7 @@ double fluid_utime(void)
return (rdtsc() / fluid_cpu_frequency); return (rdtsc() / fluid_cpu_frequency);
} }
#if defined(DARWIN) #if !defined(__i386__)
double rdtsc(void) double rdtsc(void)
{ {

View file

@ -247,7 +247,7 @@ typedef struct _fluid_server_socket_t fluid_server_socket_t;
typedef FILE* fluid_file; typedef FILE* fluid_file;
#define FLUID_MALLOC(_n) malloc(_n) #define FLUID_MALLOC(_n) malloc(_n)
#define FLUID_REALLOC(_n) realloc(_p,_n) #define FLUID_REALLOC(_p,_n) realloc(_p,_n)
#define FLUID_NEW(_t) (_t*)malloc(sizeof(_t)) #define FLUID_NEW(_t) (_t*)malloc(sizeof(_t))
#define FLUID_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t)) #define FLUID_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t))
#define FLUID_FREE(_p) free(_p) #define FLUID_FREE(_p) free(_p)