setControlCallback() - "Control Callback function must be an inline function" Error
-
setControlCallback()
- "Control Callback function must be an inline function" ErrorProblem
I'm developing a custom knob UI in HISE that draws a blob shape.
I want to click a button to regenerate the blob (change its randomness),
but I keep getting this error:Control Callback function must be an inline function
I've tried:
Making sure the function inside
setControlCallback()
is completely inlineAvoiding external global variables inside
setControlCallback()
Using
setAttribute()
to store and retrieve blob data within the knob componentCalling
Content.repaint();
after updating values
None of these approaches work. The error persists.
What I'm Trying to Achieve
- I have a custom knob UI that draws a blob shape.
- I want to click a button to regenerate the blob shape (change its randomness).
- The knob should NOT update the blob shapeβonly the button should trigger the change.
Whatβs Failing
Even when using a fully inline function like this:
btn.setControlCallback(function(component, value) { if (value) { Console.print("Blob Clicked! Generating new shape."); // Try storing data inside the knob to update later var knobComponent = Content.getComponent("knob1"); knobComponent.setAttribute("blobData", generateBlob(9, 0.35, 0.1)); Content.repaint(); // UI refresh } });
I still get the error.
Questions for the Community
- What EXACTLY does HISE require to make an inline function "valid" inside
setControlCallback()
? - What is the best way to store dynamically changing data in a knob component?
- Is there a different approach that avoids this error entirely?
Iβd appreciate any insights. Thanks!
-
@daniloprates Was that post written by chat GPT?
An inline function is declared like this:
inline function myFunc(component, value)
I recommend you check out some of the example projects.
-
Yes, this was done by ChatGPT
I tried to reply the post with this warning, but I didn't have the rights, as a new user.
Thanks David!
-
At some point we have to address that problem, I notice more and more posts just pasting the rubbish GPT output which dilutes the prestine information set available here in the forum.
Regarding the problem at hand, a single look at one of the many snippets / code examples from a good source should solve that problem, tuck
inline
before the function definition and pass it into the call.