Open fwcd opened 8 months ago
Some comments: Yes, I think the PortMidi API could run in Emscripten with a WebMIDI backend, but it might be even better to rewrite the API in javascript. PortMidi is optimized for real time by avoiding dynamic memory allocation and using lock-free queues between OS callbacks or MIDI threads and the application thread. Javascript in a web environment is much less real-time oriented and the programming model is cooperative multi-threading, so a lot of the structure of PortMidi does not really apply. Also, for javascript, it might seem strange to be encoding midi messages into a single PmMessage, which is really just an int32. On the other hand, an Emscripten version would allow applications in C++ to use PortMidi and be compiled to run in browsers. I'd be happy to discuss further with anyone interested in making PortMidi run in browsers.
On the other hand, an Emscripten version would allow applications in C++ to use PortMidi and be compiled to run in browsers
Yeah this is precisely our use case, I'm porting Mixxx, a large DJ app written in C++/Qt to the web.
Would be pretty cool to have, other libraries like
libremidi
have an Emscripten backend too.