Anyone else hit this Engine.getUptime() crasher?
-
HISE was crashing for me fairly often, mostly when left open playing MIDI for a long time.
Claude reckons to have found the cause (here's the PR fix), and it certainly seems to have fixed it for me.
Engine.getUptime()fetched the current MIDI event pointer twice, once to null-check it and again to read its timestamp, but audio thread can clear that pointer between the two reads, so timer callbacks on scripting thread would occasionally crash.The fix reads the pointer once into a local and uses that, matching every other call site in the file.
Just wondering why this hasn't come up before. Anyone else experienced random crashes while playing MIDI?
-
@dannytaurus What are you using the timer for?
-
@David-Healey For updating UI stuff.
- The latch clock on an Overs indicator around the level knob, so it stays visible for 1.5 seconds
- A fancy 'ease back' in a custom wave display - easy to get rid of that one and no great loss
-
@dannytaurus I don't do any long running animations with timers so that's probably why I haven't hit such issues.
-
@David-Healey These are both quite short animations - the Overs one is 1.5s and the wave display is 150ms.
The Overs one only runs when the level goes over, but the wave display one runs on every note.
The timer runs throughout the life of the plugin instance, but the calls to
getUptime()are limited to the short ranges above, and it's thegetUptime()calls that were triggering the crash bug. -
@dannytaurus I think I have used getUptime in a few of my interface scripts, mostly I use it in non-deferred scripts though, could that make a difference? But it looks like a good bug fix either way.
-
@David-Healey Maybe. I'm looking at whether I can ditch timers completely. Never liked using them in web app front ends, and don't like using them in HISE either.
Is there a more HISE-y way to keep an overs indicator showing for 1.5s after an over hits?
-
@David-Healey Switched the overs timer to a tick counter and removed the fancy easing in the wave display - it won't be missed.
So no more
getUptime()calls in my plugin now. But I'll leave the PR so Christoph can judge if it's worth merging. -
@dannytaurus said in Anyone else hit this Engine.getUptime() crasher?:
Is there a more HISE-y way to keep an overs indicator showing for 1.5s after an over hits?
I'm not sure what an over is :)
-
@David-Healey Sorry, I mean output level greater than 1.0, so I can show a red ring around the level knob to indicate 'over'.
-
@dannytaurus Aha, I use the built in peak meter floating tile for level display, I think it has some options for controlling the decay time, using laf you can probably style the overs to have the appearance you want. If it doesn't do what you need already I would look at extending it.
-
@David-Healey I'm just doing a ring around the knob. Can the peak meter display be coerced into something like this?

-
@dannytaurus yes, with laf