Hi Tom,
yes, it's a little hackish... but not the part you mention, I think. Overriding the "authority" of the synth over when and which samples to load is perfectly valid, in my opinion. Yes, those functions would also need to be exposed to the user via the shell and API, but that would actually be quite trivial. They would only be thin wrappers that would retrieve a preset by sfont id, bank and program and then set or unset the loaded_manually flag and potentially unload the preset.
What I think is really hackish is the way my implementation needs to go through the MIDI file and "play" all program change and bank change events on the actual synth instance, saving the state before doing so and resetting it after. But it was either that, or recreate a lot of logic from the program change mechanics in the player. Not pretty eiher way.
So all in all I agree, let's tackle this problem if and when somebody actually needs it.
I keep the PR open for a few days, maybe someone on this list will want to try it out. If nobody speaks up, I'll close it beginning of next week.
Still, it was interesting to implement it. I got to know the player a little more :-)
Cheers,
Marcus