How Does Code Execute Before onInit?
-
It appears that onInit runs twice when I choose "Compile All Scripts". And things seem to be executing during onInit in sequences that I can't make sense of.
When I compile every Script manually, I see what I expect to see in the Console, and no reported errors.
If I "Compile All Scripts", I see—in the blink of an eye:
- A few of the Console print logs that execute as my plugin boots up.
- A HISE error message about undeclared Components (which absolutely were declared).
- The Console clears again!
- I see print logs that execute as my plugin boots up (including some of the same that just appeared).
- No error messages.
(I had to take numerous screenshots until I got the timing just right to see what was in the Console before it clears again.)
This seemed to have happened once I started loading a default Preset. And my guess is that API threads are passively executing simultaneously, and not finishing when or how I expect them to (as with the SampleMap Callback, which was eventually replaced with the Broadcaster).
I don't think is a HISE bug, but something is going on with the order of operations that maybe I should know, but don't? I'm sure it's something I can fix on my end, but I am baffled.
Thank you for any ideas.
Below is the Console log if I disable clearing it.
The very first statement in onInit is to print "INIT EXECUTES!" to the Console. But it's not the first thing logged!!!! Instead, it's a whole bunch of other stuff, mostly that I cannot fathom could ever be executed, and isn't even in OnInit.
So…I'm probably doing something wrong.
If I don't disable clearing the Console at the start of onInit, I see this in the Console:
But when I load the project, I get different output:
Here is the code;