HISE Logo Forum
    • Categories
    • Register
    • Login

    Label for user preset name - get name when session reopened?

    Scheduled Pinned Locked Moved Scripting
    14 Posts 4 Posters 913 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.healeyD
      d.healey
      last edited by

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

      1 Reply Last reply Reply Quote 3
      • SteveRiggsS
        SteveRiggs @Dan Korneff
        last edited by SteveRiggs

        @dustbro This is how I usually do it...

        • Add a slider (call it “Knob1")

        • Add a preset browser

        • Add an empty label (Call it “Label1”)

        • In “Label1”s Component Specific Properties, choose font and font size to fit with GUI

        • ADD THIS CODE INTO SCRIPT EDITOR

        // SHOW CURRENT PRESET NAME IN A LABEL
        const var Label1 = Content.getComponent("Label1");
        
        inline function onKnob1Control(component, value)
        {
            if (Engine.getCurrentUserPresetName() == "")
                Content.getComponent("Label1").set("text", "Init");
            else
                Content.getComponent("Label1").set("text", Engine.getCurrentUserPresetName());
        };
        
        Content.getComponent("Knob1").setControlCallback(onKnob1Control);
        
        • Make ‘Knob1” invisible and change name of “Label1” to whatever you want, but make sure to also change all instances of “Label1” that appear in the code to that exact name

        www.anarchyaudioworx.com

        www.facebook.com/groups/audioworx/

        d.healeyD 1 Reply Last reply Reply Quote 3
        • d.healeyD
          d.healey @SteveRiggs
          last edited by

          ^ This and remember to save you project with the preset you want to be the initial preset.

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

          1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff
            last edited by

            It almost makes sense to me. So the label text is dependant upon the knob's position ?

            Dan Korneff - Producer / Mixer / Audio Nerd

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

              @dustbro Nope. You need something to trigger after on init. Since all control callbacks are triggered after on init (if they have saveInPreset enabled) it is possible to use this to trigger the code to load the preset. You could also do it with a control you are already using or with a timer callback.

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

              Dan KorneffD ulrikU 2 Replies Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @d.healey
                last edited by

                @d-healey aahhh I had almost identical code as you guys, but a momentary button was setting the controlCallback. Linked to a Knob and all is well.

                Dan Korneff - Producer / Mixer / Audio Nerd

                1 Reply Last reply Reply Quote 0
                • ulrikU
                  ulrik @d.healey
                  last edited by

                  @d-healey I have a problem similar to this I think,
                  I have an array with 8 panels and an array with 8 buttons which are in a radio group.
                  The values from the button group control which panel that should be painted with another colour (paintRoutine), so I've set it up to work fine but on init all panels are painted in the same colour, even though the radio group buttons and the 8 panels have "saveToPreset" enabled.
                  How would you solve that problem? Is it possible to do something like you did in the video above or do I have to go another way?

                  Hise Develop branch
                  MacOs 15.3.1, Xcode 16.2
                  http://musikboden.se

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

                    @ulrik Think about it this way, if all the radio buttons are set to saveInPreset enabled then every single button is going to fire its callback after on init. So if you only want one of them to do that you need to disable saveInPreset for the other buttons. Another option is to just set the button you want to have enabled manually after on init completes.

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

                    ulrikU 1 Reply Last reply Reply Quote 0
                    • ulrikU
                      ulrik @d.healey
                      last edited by

                      @d-healey there is no problem with the buttons, they remember which state they are in when opening the plugin, the problem is that the panels is not taking the values from the buttons (which make the panels repaint) on init

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

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

                        @ulrik Can you post a minimal example?

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

                        ulrikU 1 Reply Last reply Reply Quote 0
                        • ulrikU
                          ulrik @d.healey
                          last edited by

                          @d-healey This example is not exactly as the original but it shows the issue I'm having.
                          I can see what you mean when you say the buttons will fire off each buttons callback, it's very clear in this example :)

                          So I want the buttons to remember their last state when reopened, and I want the panels to be repainted with the value from the buttons, how?

                          HiseSnippet 1313.3ocyX0uaaaCDWJMJqwatXEXO.D9ujCxGx10Yannqo4qtf0jXTm0UfffBVIZahHSJPQWGih.r2g8h12fs6njrjSbRrcQAF8+n6Nd28i2wiGoaoj9r3Xoxxd0yFEwrr+Am1iD5d60ixEVGsuk8SbNlFqYJRBqcGEQiiYAV11O50HC6UW1xL9xK2kFRE9rbVVVuSx8Yug2mqy41Zm+fGFdHMfcFuegY+rcNxWJ1SFJG.34QNdVQT+KocYmPwosjik8JGDv0RUaMUyhsrWdWYvn18jCEIy+c7X9GCYHQMq1fgRXenLL.QLx0Zud7vfVYq6XKvJsxiBOJIJ7SNGyC3i4mGM9Qi.RtFEiG1Kcevq1CCOuoAO6Bva4D38Tm19JdjNWBhsu24HAjn5PgTPQXkLWqk9mUb1SByPn2rO8R1gJfXrFta64sNoomW0mWtzVaQHux2WpB3RA4srtbyNf17thXBLdwbM.6sV4RmAtLln6wH9lLLoiR12PWAVFQLkdDII7Uobo01JADmoXP.adc3c.Bvd6BAEIrj1XVGkKAaIi0jOQUYJCgCLPPdAoy.guFhPtcqR9b4RXjAm2PPjtGOdytL8ewCz8bwXZlzdEj96Ld2dZi3U6tYLSmr42MStaEtl0OgYkpoSKPQGdPXHOJl4d9PxZDuM8ZrNX2ruFR1fjxeaj+FYx19h0yDznfwdCWvbS42bB0alX1Za0fT7qEwF0Gai521FXpIPpiS9LTNjoLVtCbNwMVpM8twpaMRys1NeM9qiscslYAkZMu.cy0kKg+JjP0v14WPNOqpnKl.5GIE.gaEPZsJUWOIyM43NUn97pPiJUu34ShpVhv6AUsnBV37gKiJ0meUFisNRkaDgKLPqZ4Ro60ivcrsfSF0uUNPia.lrBo5ySB4bQHHbb0BQJv.O5XkLz0OyqqCq9vArb6GJ8ogfaCXWAwCTmMMDm1IWorJKvZwxP1lQJ.NtlokIBQueAzi79bdnvGWESTnsNoh2UGlNpjYlj4pXQ3BFJYMLuNQFZ4yMN8h61ZdvXr0JpQAadcV31.XbImGN7SNfvD01iFF9Qn4n6DwxLCb6rbgX+IRM6Tga0RetzpkttzsD0oyTkk5hPlZphwN4p6SQWwf9ejoxRxYSDZoMYOyUlsdl9IaaKLQo3HAWeZDKk99a5aktuG5utRJBgopMcWKm0cEKBr3fMdrSRYmkA7Euei0Lqb8uFkaLCJ+jTk2cfVKEFsWwAOD6l59kWNy5V+qvuSCy+4Q6S0T7RMow+zV+bL0auO6SvsESthypN6yhuTKiLInzpcf8Clhtxx1wF80nrOFh8fQh.fnmokaFUdcJdy27p9BBpCNck+EFnohoehcjnkhAkh.fWxZNfVcDZowh+97cFULv7+DH1nHDu7qBh3ocKBD+tGZy7UEA0nhQzohvr49a6nnvsYesRNHJ6PgY1q2Yp6apWuyrwB30a+FB3kLxfAgT8jOuAeSWp.376IdGA9VAQLWOp3QIywad7l4mjMqv8oNs3Z+dSGuKME7Bm77sFuoufrryAc5v704fcYmCe+h9bw4.JI2Eq6wTshimEdxf9sgBPeFfDATiGi6ZVBOGOg1K6Xx1LQfg.KSSEVCosSEVKSnUepuR9A+jFA3aTergCfIg4o5q5bLRSF25wwAtZtUe3oyev2GCEa.Xe55TeAzowBnyyV.cZt.5r8BnyOu.57K2qN3+ZwqFnk8SJS.FsNvzJ119.AE1kY1QZ8eb6itVF
                          

                          Hise Develop branch
                          MacOs 15.3.1, Xcode 16.2
                          http://musikboden.se

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

                            Oh I see the problem now. Just check if the button's value is 1. If it isn't don't do anything.

                            inline function onBtnsControl(component, value)
                            {
                                local index = Btns.indexOf(component);
                            
                                if (value == 1)
                                {
                                    for(c in Pnls)
                                    {
                                        c.set("itemColour", "0xFFFFFFFF");
                                        c.repaint();
                                    }
                                    Pnls[index].set("itemColour", "0xFFFF0000");
                                    Pnls[index].repaint();
                                }
                            }
                            

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

                            ulrikU 1 Reply Last reply Reply Quote 1
                            • ulrikU
                              ulrik @d.healey
                              last edited by

                              @d-healey thank you, that solved it, it's so easy to forget. :)

                              Hise Develop branch
                              MacOs 15.3.1, Xcode 16.2
                              http://musikboden.se

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

                              25

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.4k

                              Posts