Removed ltconfig, fixes to FluidSynth man page, re-order of default

driver selection, implemented preset selection fallback logic.
This commit is contained in:
Josh Green 2009-03-16 01:37:21 +00:00
parent b28c01954a
commit 251f96524c
5 changed files with 87 additions and 3165 deletions

View file

@ -1,3 +1,12 @@
2009-03-15 Josh Green <jgreen@users.sourceforge.net>
* ltconfig: Removed obsolete ltconfig script by suggestion of
Sven Hoexter.
* doc/fluidsynth.1: Some fixes from Sven Hoexter.
* src/fluid_adriver.c: Re-order of default drivers to jack, alsa, pulse.
* src/fluidsynth.c (fluid_synth_program_change): Added preset selection
fallback logic: Melodic - Fallback to Bank0:prognum followed by
Bank0:Program0, Percussion - Fallback to 128:0, code re-organization.
2009-03-08 Josh Green <jgreen@users.sourceforge.net> 2009-03-08 Josh Green <jgreen@users.sourceforge.net>
* src/fluid_jack.c: Added support for Jack MIDI. * src/fluid_jack.c: Added support for Jack MIDI.
* src/fluid_mdriver.c: Registered Jack MIDI driver. * src/fluid_mdriver.c: Registered Jack MIDI driver.

View file

@ -50,11 +50,11 @@ discussed below.
FluidSynth can also be used to play a list of MIDI files. Simply run FluidSynth can also be used to play a list of MIDI files. Simply run
FluidSynth with the SoundFont and the list of MIDI files to play. In FluidSynth with the SoundFont and the list of MIDI files to play. In
this case you might not want to open the MIDI device to read external this case you might not want to open the MIDI device to read external
events. Use the -n option to deactivate MIDI input. If you also events. Use the \-n option to deactivate MIDI input. If you also
want to deactivate the use of the shell, start FluidSynth with the -i want to deactivate the use of the shell, start FluidSynth with the \-i
option: 'fluidsynth -ni soundfont.sf2 midifile1.mid midifile2.mid'. option: 'fluidsynth \-ni soundfont.sf2 midifile1.mid midifile2.mid'.
.PP .PP
Run fluidsynth with the --help option to check for changes in the list of options. Run fluidsynth with the \-\-help option to check for changes in the list of options.
.SH OPTIONS .SH OPTIONS
\fBfluidsynth\fP accepts the following options: \fBfluidsynth\fP accepts the following options:

File diff suppressed because it is too large Load diff

View file

@ -129,13 +129,6 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
delete_fluid_jack_audio_driver, delete_fluid_jack_audio_driver,
fluid_jack_audio_driver_settings }, fluid_jack_audio_driver_settings },
#endif #endif
#if PULSE_SUPPORT
{ "pulseaudio",
new_fluid_pulse_audio_driver,
new_fluid_pulse_audio_driver2,
delete_fluid_pulse_audio_driver,
fluid_pulse_audio_driver_settings },
#endif
#if ALSA_SUPPORT #if ALSA_SUPPORT
{ "alsa", { "alsa",
new_fluid_alsa_audio_driver, new_fluid_alsa_audio_driver,
@ -150,6 +143,13 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
delete_fluid_oss_audio_driver, delete_fluid_oss_audio_driver,
fluid_oss_audio_driver_settings }, fluid_oss_audio_driver_settings },
#endif #endif
#if PULSE_SUPPORT
{ "pulseaudio",
new_fluid_pulse_audio_driver,
new_fluid_pulse_audio_driver2,
delete_fluid_pulse_audio_driver,
fluid_pulse_audio_driver_settings },
#endif
#if COREAUDIO_SUPPORT #if COREAUDIO_SUPPORT
{ "coreaudio", { "coreaudio",
new_fluid_core_audio_driver, new_fluid_core_audio_driver,
@ -222,10 +222,12 @@ void fluid_audio_driver_settings(fluid_settings_t* settings)
#endif #endif
/* Set the default driver */ /* Set the default driver */
#if PULSE_SUPPORT #if JACK_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "jack", 0, NULL, NULL);
#elif ALSA_SUPPORT #elif ALSA_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "alsa", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "alsa", 0, NULL, NULL);
#elif PULSE_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0, NULL, NULL);
#elif OSS_SUPPORT #elif OSS_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL);
#elif COREAUDIO_SUPPORT #elif COREAUDIO_SUPPORT
@ -236,8 +238,6 @@ void fluid_audio_driver_settings(fluid_settings_t* settings)
fluid_settings_register_str(settings, "audio.driver", "sndman", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "sndman", 0, NULL, NULL);
#elif PORTAUDIO_SUPPORT #elif PORTAUDIO_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "portaudio", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "portaudio", 0, NULL, NULL);
#elif JACK_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "jack", 0, NULL, NULL);
#elif DART_SUPPORT #elif DART_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "dart", 0, NULL, NULL); fluid_settings_register_str(settings, "audio.driver", "dart", 0, NULL, NULL);
#elif AUFILE_SUPPORT #elif AUFILE_SUPPORT

View file

@ -1210,9 +1210,14 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
fluid_channel_t* channel; fluid_channel_t* channel;
unsigned int banknum; unsigned int banknum;
unsigned int sfont_id; unsigned int sfont_id;
int subst_bank, subst_prog;
if ((prognum >= 0) && (prognum < FLUID_NUM_PROGRAMS) && if ((prognum < 0) || (prognum >= FLUID_NUM_PROGRAMS) ||
(chan >= 0) && (chan < synth->midi_channels)) { (chan < 0) || (chan >= synth->midi_channels))
{
FLUID_LOG(FLUID_ERR, "Index out of range (chan=%d, prog=%d)", chan, prognum);
return FLUID_FAILED;
}
channel = synth->channel[chan]; channel = synth->channel[chan];
banknum = fluid_channel_get_banknum(channel); banknum = fluid_channel_get_banknum(channel);
@ -1220,24 +1225,50 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
/* inform the channel of the new program number */ /* inform the channel of the new program number */
fluid_channel_set_prognum(channel, prognum); fluid_channel_set_prognum(channel, prognum);
if (synth->verbose) { if (synth->verbose)
FLUID_LOG(FLUID_INFO, "prog\t%d\t%d\t%d", chan, banknum, prognum); FLUID_LOG(FLUID_INFO, "prog\t%d\t%d\t%d", chan, banknum, prognum);
}
/* special handling of channel 10 (or 9 counting from 0). channel /* Special handling of channel 10 (or 9 counting from 0). channel
10 is the percussion channel. */ * 10 is the percussion channel.
if (channel->channum == 9) { *
* FIXME - Shouldn't hard code bank selection for channel 10. I think this
/* try to search the drum bank first for the given program # */ * is a hack for MIDI files that do bank changes in GM mode. Proper way to
* handle this would probably be to ignore bank changes when in GM mode.
*/
if (channel->channum == 9)
preset = fluid_synth_find_preset(synth, DRUM_INST_BANK, prognum); preset = fluid_synth_find_preset(synth, DRUM_INST_BANK, prognum);
else preset = fluid_synth_find_preset(synth, banknum, prognum);
/* if that fails try to search the melodic instrument */ /* Fallback to another preset if not found */
if (preset == NULL) { if (!preset)
preset = fluid_synth_find_preset(synth, banknum, prognum); {
subst_bank = banknum;
subst_prog = prognum;
/* Melodic instrument? */
if (channel->channum != 9 && banknum != DRUM_INST_BANK)
{
subst_bank = 0;
/* Fallback first to bank 0:prognum */
preset = fluid_synth_find_preset(synth, 0, prognum);
/* Fallback to first preset in bank 0 */
if (!preset && prognum != 0)
{
preset = fluid_synth_find_preset(synth, 0, 0);
subst_prog = 0;
}
}
else /* Percussion: Fallback to preset 0 in percussion bank */
{
preset = fluid_synth_find_preset(synth, DRUM_INST_BANK, 0);
subst_prog = 0;
} }
} else { if (preset)
preset = fluid_synth_find_preset(synth, banknum, prognum); FLUID_LOG(FLUID_WARN, "Instrument not found [bank=%d prog=%d], substituted [bank=%d prog=%d]",
banknum, prognum, subst_bank, subst_prog);
} }
sfont_id = preset? fluid_sfont_get_id(preset->sfont) : 0; sfont_id = preset? fluid_sfont_get_id(preset->sfont) : 0;
@ -1247,10 +1278,6 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
return FLUID_OK; return FLUID_OK;
} }
FLUID_LOG(FLUID_ERR, "Index out of range (chan=%d, prog=%d)", chan, prognum);
return FLUID_FAILED;
}
/* /*
* fluid_synth_bank_select * fluid_synth_bank_select
*/ */