Forum
    • Categories
    • Register
    • Login

    How do I flush the UI parameters on first run??

    Scheduled Pinned Locked Moved Solved General Questions
    15 Posts 2 Posters 78 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.
    • OrvillainO
      Orvillain @David Healey
      last edited by

      @David-Healey said in How do I flush the UI parameters on first run??:

      @Orvillain said in How do I flush the UI parameters on first run??:

      I would guess that what is happening is, the parameters push through their values before the processorId or parameterId has been assigned.

      Can you change the order that this happens? If it's all triggered by control callback then the order is based on the component list.

      I'm not sure, but is that actually under my control? I imagine the order of operations that HISE uses is something like:
      construct UI components
      restore UI component values
      restore processor graph / SlotFX state
      run script init / callbacks

      ???

      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
      Crafting sound at every level. From strings to signal paths, samples to systems.

      David HealeyD 1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey @Orvillain
        last edited by

        @Orvillain said in How do I flush the UI parameters on first run??:

        run script init / callbacks

        This is the important part. The last thing to run are the callbacks, in the order that the components appear in the module list.

        So if you have a callback that sets the active effect, and then other callbacks that set the effect's parameter values, you might get what you want by changing their order.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        OrvillainO 1 Reply Last reply Reply Quote 0
        • OrvillainO
          Orvillain @David Healey
          last edited by Orvillain

          @David-Healey said in How do I flush the UI parameters on first run??:

          @Orvillain said in How do I flush the UI parameters on first run??:

          run script init / callbacks

          This is the important part. The last thing to run are the callbacks, in the order that the components appear in the module list.

          So if you have a callback that sets the active effect, and then other callbacks that set the effect's parameter values, you might get what you want by changing their order.

          oooooooo... I've just realised something .....

          My generic UI parameters themselves do not have a callback assigned to them. IE: I never call uiParam.setControlCallback(blahblahblah)

          I currently rely entirely on my effect load menu to do the following, and in this order:

          1. Get the menus component id.
          2. Derive the effect slot id string from the menu id.
          3. Read the menu item text - force it to lower case.
          4. Get the slotFX processor for the slot we want to address.
          5. Look up the hardcoded effect name for the chosen effect; using a map that takes in the lowercase menu item, and returns the name of the hardcoded effect to load.
          6. call setEffect(effectToLoad) on the slotFX instance.

          At this point, my effect is loaded.

          1. If the effect we loaded was the "empty" one, then just hide all of the parameters, and reset all of their attributes to blank slates.

          If it wasn't "empty"... then do this:
          8. Fetch the UI layout+binding spec for the effect.
          9. Bind the generic UI controls to that effects parameters.

          9.1 - build the UI prefix for the slot.
          9.2 - collect the UI components.
          9.3 - clear existing bindings.
          9.4 - set processorId to the correct effect slot name.
          9.5 - set the parameterId to the correct effect parameter name.

          At this point, the knob does control the DSP.

          10 - setup the other binding parameters (min, max, stepSize, colours, etc)
          11 - Hide any UI widgets that were not used.

          ... so in effect.... my actual UI parameters within each of my effect slots, do not have callbacks themselves. I rely entirely on the menu... which thinking about it... feels a bit stupid.

          Effectively, I'm relying entirely on HISE's attachment of processorId and parameterId - and I don't really know when that happens in relation to the callback.

          As I say; my UI parameters always look correct. They sound correct when I load a preset. They do not sound correct when I load a DAW project.

          Musician - Instrument Designer - Sonic Architect - Creative Product Owner
          Crafting sound at every level. From strings to signal paths, samples to systems.

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @Orvillain
            last edited by

            @Orvillain said in How do I flush the UI parameters on first run??:

            Effectively, I'm relying entirely on HISE's attachment of processorId and parameterId - and I don't really know when that happens in relation to the callback.

            This is perfectly valid, you don't need to use control callbacks unless you need behaviour that you can't get with this setup.

            There's basically an internal callback and I believe it is triggered after all of the script callbacks.

            @Orvillain said in How do I flush the UI parameters on first run??:

            9.5 - set the parameterId to the correct effect parameter name.

            What happens if after this stage you call .changed for each of those components?

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            OrvillainO 1 Reply Last reply Reply Quote 0
            • OrvillainO
              Orvillain @David Healey
              last edited by

              @David-Healey said in How do I flush the UI parameters on first run??:

              What happens if after this stage you call .changed for each of those components?

              I get this in the Console:

              Interface: Skipping changed() callback during onInit for grf_FXEngine1_FX1_Graph1
              Interface: Skipping changed() callback during onInit for btn_FXEngine1_FX1_Sw1
              Interface: Skipping changed() callback during onInit for menu_FXEngine1_FX1_Menu1
              Interface: Skipping changed() callback during onInit for btn_FXEngine1_FX1_Sw2
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param1
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param2
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param3
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param4
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param5
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param6
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param7
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param8
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param9
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param10
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param11
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param12
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param13
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param14
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param15
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param16
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param1
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param2
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param3
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param4
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param5
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param6
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param7
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param8
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param9
              Interface: Skipping changed() callback during onInit for knb_FXEngine1_FX1_Param10
              
              

              Musician - Instrument Designer - Sonic Architect - Creative Product Owner
              Crafting sound at every level. From strings to signal paths, samples to systems.

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @Orvillain
                last edited by

                @Orvillain Are you calling .changed() from the menu's callback?

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                OrvillainO 1 Reply Last reply Reply Quote 0
                • OrvillainO
                  Orvillain @David Healey
                  last edited by

                  @David-Healey said in How do I flush the UI parameters on first run??:

                  @Orvillain Are you calling .changed() from the menu's callback?

                  Yeah I am, there's no other callback to use right now.

                  Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                  Crafting sound at every level. From strings to signal paths, samples to systems.

                  David HealeyD 1 Reply Last reply Reply Quote 0
                  • David HealeyD
                    David Healey @Orvillain
                    last edited by

                    @Orvillain Ok, what about using a timer that is started at the end of the callback, and in the timer you call .changed()

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    OrvillainO 1 Reply Last reply Reply Quote 0
                    • OrvillainO
                      Orvillain @David Healey
                      last edited by

                      @David-Healey said in How do I flush the UI parameters on first run??:

                      Ok, what about using a timer that is started at the end of the callback, and in the timer you call .changed()

                      I'll give it a go!

                      Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                      Crafting sound at every level. From strings to signal paths, samples to systems.

                      1 Reply Last reply Reply Quote 0
                      • OrvillainO
                        Orvillain
                        last edited by

                        hmmm... no that didn't seem to work either.

                        Now, I might've been being dumb all along... but on a hunch, I tried a different effect.... and it seems like at least some of those parameters DO flush on init correctly... and some of them don't.

                        So now I'm thinking, maybe this is a custom C++ code or script node problem.

                        Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                        Crafting sound at every level. From strings to signal paths, samples to systems.

                        David HealeyD 1 Reply Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @Orvillain
                          last edited by

                          @Orvillain said in How do I flush the UI parameters on first run??:

                          So now I'm thinking, maybe this is a custom C++ code or script node problem.

                          Could be...

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          OrvillainO 1 Reply Last reply Reply Quote 0
                          • OrvillainO
                            Orvillain @David Healey
                            last edited by Orvillain

                            @David-Healey said in How do I flush the UI parameters on first run??:

                            @Orvillain said in How do I flush the UI parameters on first run??:

                            So now I'm thinking, maybe this is a custom C++ code or script node problem.

                            Could be...

                            ooooo... looks like it might be any of my effects that uses my ExpSmoothedFloat class to smooth the incoming parameter changes!

                            I've genuinely been slamming my head against this for the past 4 hours.... and it was nothing to do with the UI side after all... at least it seems like.

                            Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                            Crafting sound at every level. From strings to signal paths, samples to systems.

                            1 Reply Last reply Reply Quote 0
                            • OrvillainO
                              Orvillain
                              last edited by

                              God I hate my stupid brain sometimes.

                              So yes... that is exactly what it was....

                              In my c++ I run these smoothers for some parameters. To avoid discontinuities when turning a parameter. You generally don't want to flush 1000's of parameter updates on things like delay times, so you smooth it out over time. Maybe only 10ms, but it helps to make it sound better and brings down CPU too. Cool.

                              And that was all well and good. Worked fine.

                              But in my setParameter callbacks, I was only setting the target. I wasn't setting the initial value. Which now I read it, is literally the dumbest stupidest mistake that I could've made.

                              Time for more Guinness.

                              Musician - Instrument Designer - Sonic Architect - Creative Product Owner
                              Crafting sound at every level. From strings to signal paths, samples to systems.

                              1 Reply Last reply Reply Quote 1
                              • OrvillainO Orvillain marked this topic as a question
                              • OrvillainO Orvillain has marked this topic as solved
                              • First post
                                Last post

                              28

                              Online

                              2.1k

                              Users

                              13.1k

                              Topics

                              113.5k

                              Posts