Hi,
I had the strangest thing happen to my code and I was wondering if someone could explain it.
I have a black-box classify(...)
function that I need to call from the rt-thread (once in a while).
It does allocate memory, but only the very first time that it’s called from the rt-thread.
Calling it before the real-time processing starts (in Juce’s processor constructor or prepareToPlay()) doesn’t change a thing, and the function still allocates later when it is called from the rt-thread (this was already a bit confusing).
Now for the strange part,
I placed this at the beginning of my processBlock:
if (this->doPrimeClassifier) {
doPrimeClassifier = false;
classify(...);
}
Where doPrimeClassifier
starts as true and is never modified by anything else. I’m reasonably sure that there is no change whatsoever in the arguments of the function.
And magically, no more MSW, no SIGXCPU, nothing.
No audible audio clicks at load time nor later.
I mean, it’s great that it works, but I was wondering why.
It’s almost like the first call is not executed in Xenomai, but it’s also not executed in the same way that the processor constructor or prepareToPlay methods are, otherwise calling classify() in the processBlock or in those methods would make no difference at all.
I’ve tried to reason about it but it might be something that happens at a low level in sushi or xenomai.
Thanks, have a nice day,
Domenico