I made some progress with implementing Embind and EM_ASM to Ofelia.
EM_ASM is for calling Java Script from C++ and Embind for calling C++ from Java Script.
The Embind functions are defined in ofApp.cpp.
I also put an example in my fork: https://github.com/Jonathhhan/ofxOfelia/tree/master/EmscriptenEmbindEmasmExample
I am very new to C++ programming, so I am happy if somebody wants to optimize / extend the code.
I am also happy about suggestions.
I wonder especially how to do two things:
How to send arrays to Ofelia with Embind (something with std::vector?). That would be great for connecting Ofelia to webMIDI...
And if it is possible to return a value in Ofelia with Embind (right now I can set values with Embind, but still have to call them from Ofelia). Perhaps it would be possible if Embind would be defined inside Ofelia instead of ofApp.cpp, because then it could be called directly, like it works with Open Frameworks.
And here is a first attempt to connect Ofelia to webMIDI (there are some timing problems, perhaps because [makenote] knows no noteoff but only velocity 0?):