09-03-2023, 12:09 PM
(09-03-2023, 11:26 AM)SagaraS Wrote: There must be a solution how to use Windows' own MIDI system in such a way that it is used as I have described. But not that a sound font is integrated into the EXE.I disagree. Using a custom soundfont is a better cross-platform solution. It gives you complete control over how your MIDI music sounds on Windows, Linux and macOS. Now, if you do not care about Linux and macOS (that QB64-PE supports), then that's another story.
That's not a good solution.
@DSMan195276 and I have had detailed discussion on supporting OS specific MIDI APIs that do not use soundfont here Add MIDI support to _SNDOPEN() · Issue #115 · QB64-Phoenix-Edition/QB64pe (github.com). We may add a cross-platform version of this using an abstraction library like RtMidi (https://github.com/thestk/rtmidi) in the future. Unfortunately, stuff like this takes time.
Having said that, I did put together a Windows-only QB64-PE library that does exactly what you need at the moment. I.e., it loads a MIDI file from a buffer and plays it using the Win32 WinMM MIDI streaming output APIs. You can find the example here: a740g/WinMIDI-Player-64: Win32 WinMM MIDI player & library for QB64-PE (github.com). The API section has a terse API doc. and the NOTES section has my notes. The library itself can be found here: a740g/Toolbox64: A740g's collection of libraries for QB64-PE (github.com).
Cheers!