I am using portmidi on MacOS, Linux and on FreeBSD. It works fine. On Windows, I use Windows Multimedia API.
If you want to take a look:
https://github.com/BobanSpasic/PSS-Revive/tree/mainUnder ext_units you'll find midi.pas (Windows), and portmidi.pas (Linux, MacOS, FreeBSD).
Under units, you'll find untUnPortMIDI.pas, that is a supplement to midi.pas in order to have the functionality of portmidi.pas.
If you can get your units to have some similar functionality and API, I would be glad to use them instead of portmidi and have one less dependency.
For Linux, MarkMLI did a lot of work on Alsa MIDI:
https://github.com/MarkMLl/asoundUnfortunately, for someone like me, who does not understand how Alsa sequencer works, this one looks extremely complicated, and MarkMLI wasn't really friendly in helping with it.
Although I appreciate his work, I needed an alternative. After a lot of experimenting, portmidi worked nice for me, except under Windows 64bit (no 64bit DLL found to download).