Open nickkeane opened 1 year ago
Do you mean directly using it (not using via virtual serial port which is already possible)? I can't seem to find any clear programming examples that shows how to implement it properly..
Yes, directly integrated into the Application via a library (libfluidsynth, libmt32emu) with configs for usage and MT-32/CM-32L ROM Paths and Soundfont Paths.
I know DOSBox Staging has a version of libfluidsynth and libmt32emu integrated, so that code base has an implementation of both libraries. I can try digging through the source to find where it's implemented, but you might want to ask their team for help in how they did it in case I miss something. I think DOSBox-X has a similar implementation as well.
https://github.com/dosbox-staging/dosbox-staging https://github.com/joncampbell123/dosbox-x
FluidSynth has API documentation of the library for the latest 2.x branch here:
https://www.fluidsynth.org/api/UsageGuide.html
https://github.com/FluidSynth/fluidsynth
Some documentation and the source code for libmt32emu can be found in Munt's mt32emu subfolder at:
https://github.com/munt/munt/tree/master/mt32emu
There's also a project called EmuSC I forgot to mention that's looking to emulate a Roland SoundCanvas SC-55 using ROM dumps as a library, but it's currently in very early development. Nobody has integrated it yet, so I wouldn't worry about that one for a few months or years probably.
From a UI standpoint, something like this would be useful to get all the settings in if integrated:
In this case the SystemMIDI option would represent the setting for the external MIDI access as it is now.
In DOSBox-Staging, Fluidsynth and libmt32emu are optionally included as static libraries when DOSBox is built.
The bulk of the code for using libfluidsynth and libmt32emu can be found at: https://github.com/dosbox-staging/dosbox-staging/blob/main/include/midi.h https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi.cpp https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi_handler.h https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi_fluidsynth.h https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi_fluidsynth.cpp https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi_mt32.h https://github.com/dosbox-staging/dosbox-staging/blob/main/src/midi/midi_mt32.cpp
The versions and locations of each can be found here, as Staging uses *.wrap files from Meson to import external libraries rather than CMake, in case you need the exact versions used: https://github.com/dosbox-staging/dosbox-staging/blob/main/subprojects/fluidsynth.wrap https://github.com/dosbox-staging/dosbox-staging/blob/main/subprojects/mt32emu.wrap
Munt MT-32/CM-32L is now built-in. It was surprisingly easy to do, nice library API, documentation was a bit lacking as usual :)
Fluidsynth does not seem to be as simple (basically: init, move midi bytes from emulated serial port to emulator byte by byte, read samples from emulator
Add support for FluidSynth General MIDI and libmt32emu.