HISE Logo Forum
    • Categories
    • Register
    • Login

    How many times is the onControl callback supposed to be triggered on compile?

    Scheduled Pinned Locked Moved Scripting
    9 Posts 3 Posters 151 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.
    • VirtualVirginV
      VirtualVirgin
      last edited by

      I was checking the onControl callback for handling certain tasks for persistent data when I noticed a bit of redundancy.
      Here in my project it is being triggered 171 times:
      Screenshot 2025-03-02 at 4.12.04 PM.png
      It was my impression that it only needs to run the onControl once after everything compiles.
      How/why is it getting triggered so many times?
      Is that something I need to fix or is that expected?

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

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

        @VirtualVirgin I suspect it will be triggered once for every control on the UI that has saveInPreset enabled.

        @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

        Is that something I need to fix or is that expected?

        The OnControl callback is a left over thing from the early days of HISE before we were able to assign individual callbacks to controls. I wouldn't use it these days, I guess it might even be removed in the future or hidden behind a preprocessor definition.

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

        VirtualVirginV 2 Replies Last reply Reply Quote 1
        • VirtualVirginV
          VirtualVirgin @d.healey
          last edited by

          @d-healey I'm imagining that you answered that question before I even submitted it! Lightning fast response.

          You can listen to my orchestral mockups here:
          https://www.virtualvirgin.net/

          1 Reply Last reply Reply Quote 2
          • clevername27C
            clevername27 @VirtualVirgin
            last edited by

            @VirtualVirgin How were you able to count the number of calls?

            VirtualVirginV 1 Reply Last reply Reply Quote 0
            • VirtualVirginV
              VirtualVirgin @clevername27
              last edited by VirtualVirgin

              @clevername27 said in How many times is the onControl callback supposed to be triggered on compile?:

              @VirtualVirgin How were you able to count the number of calls?

              I put

              reg onControlCount = 0;
              

              on the onInit
              then put

              onControlCount++;
              Console.print("count: " + onControlCount);
              

              in the onControl callback.

              You can listen to my orchestral mockups here:
              https://www.virtualvirgin.net/

              1 Reply Last reply Reply Quote 1
              • VirtualVirginV
                VirtualVirgin @d.healey
                last edited by

                @d-healey said in How many times is the onControl callback supposed to be triggered on compile?:

                @VirtualVirgin I suspect it will be triggered once for every control on the UI that has saveInPreset enabled.

                @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                Is that something I need to fix or is that expected?

                The OnControl callback is a left over thing from the early days of HISE before we were able to assign individual callbacks to controls. I wouldn't use it these days, I guess it might even be removed in the future or hidden behind a preprocessor definition.

                Right now I am using it to update some things after the persistent values have been loaded.
                How do I then update those things without the onControl?
                The advantage, I think with the onControl callback is that I can order them so they load in a specified order, whereas I generally cannot change the order of callbacks of independent components in a script.

                You can listen to my orchestral mockups here:
                https://www.virtualvirgin.net/

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @VirtualVirgin
                  last edited by

                  @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                  Right now I am using it to update some things after the persistent values have been loaded.

                  Put the same code in one of your control's callbacks. You could even add a hidden dedicated "post init" component at the end of the list.

                  @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                  I generally cannot change the order of callbacks of independent components in a script.

                  They execute in the order they are placed in the widget list.

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

                  VirtualVirginV 1 Reply Last reply Reply Quote 1
                  • VirtualVirginV
                    VirtualVirgin @d.healey
                    last edited by

                    @d-healey said in How many times is the onControl callback supposed to be triggered on compile?:

                    @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                    Right now I am using it to update some things after the persistent values have been loaded.

                    Put the same code in one of your control's callbacks. You could even add a hidden dedicated "post init" component at the end of the list.

                    @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                    I generally cannot change the order of callbacks of independent components in a script.

                    They execute in the order they are placed in the widget list.

                    The "Component List"?
                    Screenshot 2025-03-03 at 12.46.12 PM.png

                    You can listen to my orchestral mockups here:
                    https://www.virtualvirgin.net/

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @VirtualVirgin
                      last edited by

                      @VirtualVirgin said in How many times is the onControl callback supposed to be triggered on compile?:

                      The "Component List"?

                      Yea

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

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

                      19

                      Online

                      1.7k

                      Users

                      11.9k

                      Topics

                      103.3k

                      Posts