Hello Louis,
Quoting "Louis B." <address@hidden>:
Hi All,
I have another small change I would like to see in the next release if
possible.
when commenting out the following line 51 from example.c no sound is
produced
/* Select bank 0 and preset 0 in the SoundFont we just loaded on
channel 0 */
//fluid_synth_program_select(synth, 0, sfont_id, 0, 0);
I believe that the system should default to bank 0 and preset 0 when a
sound font is first loaded. Some midi files forget to set a preset
especially single piano pieces. This caught me out a few times and I
had to add the following code to my start up.
for (int channel = 0; channel < MAX_MIDI_CHANNELS ; channel++)
{
fluid_synth_program_change(m_synth, channel, GM_PIANO_PATCH);
}
However the standalone version of fluidsynth does not have this
problem and defaults to preset 0.
I think it does default to bank 0 preset 0 on all channels. The issue is
actually with the fluid_synth_sfload() call in the example code. The 3rd
parameter is called reset_presets. If its FALSE then no instrument changes
are made on any MIDI channels. If TRUE then all MIDI channels are refreshed
(as if they had bank/program change messages sent) which may cause new
instruments to get used from the loaded SoundFont. Perhaps the example
should just be changed to pass TRUE as the 3rd parameter.
Thanks
Louis
Regards,
Josh