PortMidi / portmidi

portmidi is a cross-platform MIDI input/output library
Other
116 stars 31 forks source link

Haiku support #38

Closed jmairboeck closed 1 year ago

jmairboeck commented 1 year ago

This adds an implementation for Haiku using Haiku's MIDI 2 kit.

I only tested it a little using a virtual device created by the MidiSynth application. Timing and latency handling is still mostly missing and could probably be improved.

This also makes the code compatible with Haiku's 32 bit legacy compiler (GCC 2.95) because it was rather easy to do. I just mostly had to move a few variable declarations to the beginning of their block so that it conforms to C89. If that is seen as unnecessary, I could remove that also. Haiku also provides a modern compiler.

jmairboeck commented 1 year ago

I have also started adding support for the software synthesizer support (BMidiSynth), but have not finished it yet. Maybe you can wait with merging this until I have finished it (if I succeed at it).

jmairboeck commented 1 year ago

I added a fixed output device for the soft synth.

rbdannenberg commented 1 year ago

Can you tell me the status of PortMidi on haiku? E.g. it could be short [and sysex?] messages work for output [and input?], [and timestamps are implemented?] [and virtual ports are implemented?] [and pm_test/README.txt tests [all?] work [except for tests ...?]]. That would help set the right expectations and be good for the main README and github description.

jmairboeck commented 1 year ago

The basic functionality should work. It is a rather minimal implementation, however. Input and output devices, as well as virtual devices work, and there is an additional output device for the fluidsynth-based software synthesizer that Haiku supports. All Midi endpoints that are available in Haiku's MidiRoster are exposed as input and output devices in PortMidi. Timestamps are supported (as in, they are passed to the appropriate function calls), however, I didn't implement the latency and timing handling that the other implementations support. There are TODOs in the code about this.

I didn't run all the tests, and I only tested with a virtual Midi keyboard in a virtual machine. I will try to run all the tests and report back the results.

rbdannenberg commented 1 year ago

Thanks. I know tests are a pain because you have to select device numbers every time and there is a lot of manual interaction, but tests have been pretty effective in identifying problems. Please ask about anything that's unclear -- I tried to keep test descriptions concise but as a "user" you might have ideas to improve them.

jmairboeck commented 1 year ago

I ran the tests in my Haiku VM (in Virtualbox). Sysex doesn't seem to work. Latency is not handled correctly, as expected. PortMidi's virtual devices also don't work quite right. They don't show up when they should, but do so sometimes afterwards, which is a bit strange. I'll attach the terminal log files.

terminal1.txt terminal2.txt terminal3.txt