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>
* src/fluid_jack.c: Added support for Jack MIDI.
* 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 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
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
option: 'fluidsynth -ni soundfont.sf2 midifile1.mid midifile2.mid'.
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
option: 'fluidsynth \-ni soundfont.sf2 midifile1.mid midifile2.mid'.
.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
\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,
fluid_jack_audio_driver_settings },
#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
{ "alsa",
new_fluid_alsa_audio_driver,
@ -150,6 +143,13 @@ fluid_audriver_definition_t fluid_audio_drivers[] = {
delete_fluid_oss_audio_driver,
fluid_oss_audio_driver_settings },
#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
{ "coreaudio",
new_fluid_core_audio_driver,
@ -222,10 +222,12 @@ void fluid_audio_driver_settings(fluid_settings_t* settings)
#endif
/* Set the default driver */
#if PULSE_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "pulseaudio", 0, NULL, NULL);
#if JACK_SUPPORT
fluid_settings_register_str(settings, "audio.driver", "jack", 0, NULL, NULL);
#elif ALSA_SUPPORT
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
fluid_settings_register_str(settings, "audio.driver", "oss", 0, NULL, NULL);
#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);
#elif PORTAUDIO_SUPPORT
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
fluid_settings_register_str(settings, "audio.driver", "dart", 0, NULL, NULL);
#elif AUFILE_SUPPORT

View file

@ -1210,45 +1210,72 @@ fluid_synth_program_change(fluid_synth_t* synth, int chan, int prognum)
fluid_channel_t* channel;
unsigned int banknum;
unsigned int sfont_id;
int subst_bank, subst_prog;
if ((prognum >= 0) && (prognum < FLUID_NUM_PROGRAMS) &&
(chan >= 0) && (chan < synth->midi_channels)) {
channel = synth->channel[chan];
banknum = fluid_channel_get_banknum(channel);
/* inform the channel of the new program number */
fluid_channel_set_prognum(channel, prognum);
if (synth->verbose) {
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
10 is the percussion channel. */
if (channel->channum == 9) {
/* try to search the drum bank first for the given program # */
preset = fluid_synth_find_preset(synth, DRUM_INST_BANK, prognum);
/* if that fails try to search the melodic instrument */
if (preset == NULL) {
preset = fluid_synth_find_preset(synth, banknum, prognum);
}
} else {
preset = fluid_synth_find_preset(synth, banknum, prognum);
}
sfont_id = preset? fluid_sfont_get_id(preset->sfont) : 0;
fluid_channel_set_sfontnum(channel, sfont_id);
fluid_channel_set_preset(channel, preset);
return FLUID_OK;
if ((prognum < 0) || (prognum >= FLUID_NUM_PROGRAMS) ||
(chan < 0) || (chan >= synth->midi_channels))
{
FLUID_LOG(FLUID_ERR, "Index out of range (chan=%d, prog=%d)", chan, prognum);
return FLUID_FAILED;
}
FLUID_LOG(FLUID_ERR, "Index out of range (chan=%d, prog=%d)", chan, prognum);
return FLUID_FAILED;
channel = synth->channel[chan];
banknum = fluid_channel_get_banknum(channel);
/* inform the channel of the new program number */
fluid_channel_set_prognum(channel, prognum);
if (synth->verbose)
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
* 10 is the percussion channel.
*
* FIXME - Shouldn't hard code bank selection for channel 10. I think this
* 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);
else preset = fluid_synth_find_preset(synth, banknum, prognum);
/* Fallback to another preset if not found */
if (!preset)
{
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;
}
if (preset)
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;
fluid_channel_set_sfontnum(channel, sfont_id);
fluid_channel_set_preset(channel, preset);
return FLUID_OK;
}
/*