Overhaul of fluid~ to add SMMF support and soundfont search, fixes #692.
This is an extensive (but fully backwards-compatible) upgrade of the fluid~ external. It features:
Support for the SMMF MIDI message format, which is described in more detail below.
Canvas directory and path search for soundfont files, so that these can be found more easily without having to use absolute pathnames. The .sf2 extension for soundfont files is supplied as well if it isn't specified explicitly in the soundfont filename.
Bugfixes: Fixed a memory leak on fluidsynth synths and settings when a fluid~ object is deleted. Also, program changes are now correctly translated between Pd and Fluidsynth. Note that the program numbers are 1-based in Pd and 0-based in Fluidsynth, which wasn't taken account of previously.
A few cosmetic changes to help and error messages. Mostly we just turned some post() calls into proper error messages, so that the fluid~ objects causing an error, such as not being able to find the soundfont file, can be tracked down more easily.
The help patch has been updated and converted to pddp format. The accompanying simple_onthego_synth patch has been updated as well, as it was outdated and failed to work, and the midi-input.pd abstraction from https://bitbucket.org/agraef/pd-smmf is included. We still don't include any soundfont files to conserve space, but both the help and the simple_onthego_synth patch now have clickable links to Tim Brechbill's small (~6MB) GM soundfont, and the extensive soundfont list in the Musescore manual.
Backwards Compatibility (a.k.a. "Legacy" Mode)
In "legacy" mode, which is the default, the object is 100% backwards-compatible (except for the soundfont file search, which wasn't supported at all previously), so that existing patches will continue to work without any changes.
In SMMF mode, which is invoked with the new
-smmf option (used either as a creation argument, or with the
init message), the SMMF message format can be used to denote MIDI messages. Legacy messages still continue to work in SMMF mode as well, except the
bend messages which are used in both formats with the same argument count but different argument order, so SMMF mode overrides the legacy messages. However, the corresponding shortcuts
b of the legacy format still work even in SMMF mode.
Rationale: SMMF offers the following advantages over the legacy message interface that fluid~ currently uses:
It covers all MIDI voice messages, as well as system exclusive messages. Note that sysex support is particularly interesting because it allows to pass tuning data using sysex messages following the MIDI Tuning Standard (MTS), which fluidsynth readily supports.
It enforces a close 1-1 correspondence between the Pd MIDI objects and the message format (it uses the same basenames as message selectors, and has the arguments in the right order to easily interface with the Pd MIDI objects).
It is is readily supported by some helper abstractions (midi-input.pd and midi-output.pd, available at https://bitbucket.org/agraef/pd-smmf; the former is now also included with the fluid~ external).