HISE Logo Forum
    • Categories
    • Register
    • Login

    setControlCallback() - "Control Callback function must be an inline function" Error

    Scheduled Pinned Locked Moved Scripting
    4 Posts 3 Posters 73 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      daniloprates
      last edited by

      setControlCallback() - "Control Callback function must be an inline function" Error

      πŸ›  Problem

      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 inline
      • βœ… Avoiding external global variables inside setControlCallback()
      • βœ… Using setAttribute() to store and retrieve blob data within the knob component
      • βœ… Calling Content.repaint(); after updating values

      None of these approaches work. The error persists.


      πŸ”§ What I'm Trying to Achieve

      1. I have a custom knob UI that draws a blob shape.
      2. I want to click a button to regenerate the blob shape (change its randomness).
      3. 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

      1. What EXACTLY does HISE require to make an inline function "valid" inside setControlCallback()?
      2. What is the best way to store dynamically changing data in a knob component?
      3. Is there a different approach that avoids this error entirely?

      I’d appreciate any insights. Thanks! πŸ™

      d.healeyD D 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @daniloprates
        last edited by d.healey

        @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.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 0
        • D
          daniloprates @daniloprates
          last edited by

          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!

          Christoph HartC 1 Reply Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @daniloprates
            last edited by

            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.

            1 Reply Last reply Reply Quote 2
            • First post
              Last post

            53

            Online

            1.7k

            Users

            11.7k

            Topics

            101.8k

            Posts