Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support WebMIDI when targeting Emscripten/WebAssembly #68

Open
fwcd opened this issue Mar 2, 2024 · 2 comments
Open

Comments

@fwcd
Copy link

fwcd commented Mar 2, 2024

Would be pretty cool to have, other libraries like libremidi have an Emscripten backend too.

@rbdannenberg
Copy link
Contributor

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.

@fwcd
Copy link
Author

fwcd commented Mar 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants