WARNING, wall of text.
I have been trying to make a little plugin that can take the modulators in HISE and send them out as a MIDI CC messages.
Sending MIDI out of HISE is possible when exporting your project as a MIDIFX plugin. Unfortunately when running as a MIDIFX plugin none of the modulators run, neither the Global Modulators or the scriptnode ones.
@d-healey mentioned in a thread that I could get the global modulators to work using the flag ENABLE_ALL_PEAK_METERS=1, but that meant that I had to use the FX plugin type instead of MIDIFX, which again meant no MIDI out.
So I ventured into the C++ code and hacked around in the processBlockCommon in HISE's MainController as detailed in this post where I could block HISE from clearing the MIDI buffer, so that you can create MIDI events using the JS code. But that meant maintaining my own fork of HISE develop branch which is not ideal.
Then @Christoph-Hart published the Message.sendToMidiOut() which I thought would be my savior, so I threw away my fork and continued to work on the now FX plugin, since I'm still dependant on Modulators and scriptnode.
I soon found out that, if I understood it correctly, that it was only meant to echo/modify the MIDI input back out to the MIDI buffer and I could not add any CC values anywhere, as doing so outside of the onController() callback it will generate an error in the JS output log. In my context I'm not expecting any CC input into the plugin, so the callback would be a useless place for me to generate my CC.
But I realized that I could use/abuse the sendToMidiOut() function he added to the MainController to do exactly what I wanted to do, but I had to do that in C++ which is fine.
So I added a floating tile with it's own C++ code as describe in the ExternalFloatingTile tutorial which, yet again worked like a charm. I could have my own timer in C++ where I could add any MIDI message I wanted and for a while it was beautiful, I thought I had cracked the problem, right until I tried to close down the Plugin UI inside my DAW. You see, when the UI is not visible, HISE calls the destructor of my C++ floating tile and for my poor plugin to work I now have to make sure it is visible somewhere on the screen at all times.
So now my options is to go back to maintaining a fork, blocking the clearing of the MIDI buffer, unless someone has the silver bullet that will save me. I would really appreciate any ideas if anyone of you have any.
Sorry for the long post.