Adventures in Extra Times and Asynchronicity
-
If you're like me, you use HISE differently than it was intended, and you get to experience fun and interesting edge cases. (Or things that look like edge cases, but are me making a mistake.)
Some examples of things that shouldn't happen:
-
The SampleMap loading callback usually finishes on-schedule, But not always. [Fixed/replaced with the new broadcaster.] -
Loading the Default Preset causes it to be loaded twice—once before onInit, and once after. [Discussed in another thread.]
-
You define a broadcaster, and it (mis)fires when it's being defined. [I think this is pretty well established?]
When debugging, you may wish to log things to the Console, to figure out what order things are happening. But as I (and another user, apparently) have experienced, this isn't necessarily effective. Because the Console doesn't always print things in order they occur—or it does, and sometimes the identical code executes with threads ending at different times. Whenever I compiled my code, the order in which my debugging Console prints occurred changed each time, seemingly at random.
Which brings us to today's issue. I changed…at some point (impossible to tell when and therefore what) in my code, and my Samplemap loading code stopped working.
But did it?
Because when I added a bunch of Engine.showMessage windows to display debugging info (and order of operations), it still didn't work. So I changed a bunch of code, and then it suddenly worked. So I removed the showMessage calls, and it stopped working. So I must have made a mistake. Long story short, it was the presence of the showMesssage calls that made the code run—presumably, during one or more of those calls, something happened that otherwise didn't—such as an unrelated thread needing to wait (and then a different thread getting to finish first). Or, something more insidious. (Or stupid, on my part.)
Anyway, if anyone else has issues like this, you can share your experiences here, and perhaps we can make sense of it all. To be sure, these issue are unlikely to effect you if you're making a sample-playback instrument with HISE (which I am not). None of this is meant as a criticism of HISE, just sharing information in the hope it helps someone else.
Update: Well, this shouldn't be.
-