HISE Logo Forum
    • Categories
    • Register
    • Login

    Is it possible to change default value after on init?

    Scheduled Pinned Locked Moved Scripting
    17 Posts 3 Posters 996 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 @Lindon
      last edited by

      @Lindon Are you using the latest version of HISE?

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

      1 Reply Last reply Reply Quote 0
      • A
        aaronventure
        last edited by aaronventure

        This is weird. The property is definitely getting set. I think the issue is with the built-in reset-to-default functionality.

        Here's your code where I disabled the built-in ResetToDefault functionality using the newly added setModifiers method, then attached a broadcaster which resets the value to whatever is in the defaultValue property. It works as expected. Except the Alt+Click is still not disabled by disabling the modifier, something I reported on a few days ago.

        Content.makeFrontInterface(600, 600);
        
        const var Knob1 = Content.getComponent("Knob1");
        
        
        inline function onButton1Control(component, value)
        {
        	Knob1.set("defaultValue", value ? 0.2 : 0.75);
        	Console.print(Knob1.get("defaultValue"));
        };
        
        Content.getComponent("Button1").setControlCallback(onButton1Control);
        
        const mods = Knob1.createModifiers();
        Knob1.setModifiers(mods.ResetToDefault, mods.disabled);
        const bc = Engine.createBroadcaster(
        { 
        	"id": Knob1Mouse,
        	"colour": -1,
        	"tags": ["control", "knob"],
        	"args": ["component", "event"]
        });
         	    
        bc.attachToComponentMouseEvents(Knob1, "All Callbacks", "Mouse Listener");
        
        bc.addListener("Mouse Callback", "-", function(component, event)
        {
        	if (event.doubleClick)
        	{
        		component.setValue(component.get("defaultValue"));
        	}
        });
        
        d.healeyD 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @aaronventure
          last edited by

          @aaronventure Thanks, seems like a pita solution, but it's a solution!

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

          A 1 Reply Last reply Reply Quote 0
          • A
            aaronventure @d.healey
            last edited by

            @d-healey Well only kind of, not fully until alt+click gets fixed. If that doesn't bother you, you can continue with your implementation and I'm sure it'll get sorted soon.

            But this is a bit dirty, yes. Reminds me of working in Kontakt.

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

              HISE is crazy sometimes. So if you also change the min and max values it works!

              HiseSnippet 867.3ocsV0saSCCE1tqFVK+HPhGfncUmDL0NfABDpk0sgpFaqhLl3tIuD2Uq4XGRbFqCgDWvCHuBbGWh3E.N1IswczAnJHWDoyOem7cN9bNN8STArzTUBBWa+QwLD95D+QR8vtCobIp2FH7MI6PS0rDubUqOJlllxBQX7Buvn.WqJx97s1qSETY.qTEBcfhGvdIOhqK01uy1bgXKZHaedji2OnSu.krqRnx.9r.oIJlFbB8X1tTiaUHH7U1LjqUI9ZplkhvUWWENxen5cxb+OfmxORvLBsP9PfxUukRDZXrQKp6PtHr+37NEAQoeYUXg7pvcH6vC4SzWVMtk0fWIB25AtxzzagonWKW50zgdyfRXGJUMmR2l3Gjvi0kVL74ZjdR3vY.EJ6tTI2WTkuiIcUfGR8JQzSXak.BSPzXslMuqG7Z4mVuNT5S0dmRS71VpNpk2y7FC7XltqJJVIAgFKYstjAQctTvkLuAYx.MWI8Tx0yzZkrkAYhRzHXLr6BAVjwVt96qWyFfURYPrBYCnYB8AFaKU3iWaulqrp2Sf2O5gvmw0+HtbJ2ZZca0ewM5YNt0pvMaz9.v6YmWETeokMwnHA5REhifdvFWLyfH4j06pzr8jMrYW8OT26hlFLXl1JhkfkLSylgijeGvFxrniXIt0ViiPGyzsgjKuMzcJIHur33nR1Sx06EyjW1rCpnVBsrUJXE3p11vdyhFVeAOjkf3Pe4UI1SIjkvkC9esM5x.mW1sfqQJNCtHb34081fpolAmBBAjLlkn4l7GuA6TXKT9XTMxFrzSzpXKiKN8Q3E+ib9rxOntynIBe7scfsiw97yGynNe47O01sy1MQib2X941Pm5EJCSXT0+hBgC3Cc4z9cP+5BDX0kJLSP0SuOyrDuv.zcM0RDyhBYJWOxcI++rkb+sT71j9bcvvYywJyfillw+Cbr3pgaP1bv.VftjfUIa8l+O2CfdkJSykGuCUmvgCaxtYQ9vsiAL3qKkLgY5FWwLGlK2zHap.9LYnU3GvSgwVFYbgwViMhhnAIpCCxG.MW9rnUCvIo8d2ZvO..xdSl6HDXyKJBtG7vf.S5eOX0vrwr5bf49yAlGLGXd3bfYs4.yilCLO92hw7KHOOSqhxGG.E82zt+Ci2TRgNKaWH5m.owcZg
              

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

              A 1 Reply Last reply Reply Quote 0
              • A
                aaronventure @d.healey
                last edited by

                @d-healey said in Is it possible to change default value after on init?:

                HISE is crazy sometimes. So if you also change the min and max values it works!

                Hm.. even if you just set them to the same value, it works, as long as you're calling set on either min or max.

                Could it be that there's an internal value change listener on the min/max which also refreshes the default value stored in some hidden variable that the ResetToDefault functionality uses? Because the reset only remembers whatever property value was set initially/at creation.

                I mean there probably is, as the midpoint thing means there's a curve in the back, which I imagine needs to be fitted and if you change the range, you have to re-do the fitting.

                I'm only musing like this because I don't know the codebase well enough (or at all) to find these answers in the source 😄

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

                  @aaronventure said in Is it possible to change default value after on init?:

                  Could it be that there's an internal value change listener on the min/max which also refreshes the default value stored

                  Maybe, but it also works if you set the min/max before the defaultValue

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

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    aaronventure @d.healey
                    last edited by

                    @d-healey Well fuck. What then? Maybe component property changes get executed in bulk (if they are one after another) before internal listeners are called?

                    Looking forward to finding out the reason for this behavior 😃

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

                      @aaronventure Yeah it will be interesting. I'm finding in my real project it's not 100% reliable still. Sometimes the default value doesn't get set properly. Could be a bug in my script, but I don't think it is.

                      Edit: Seems to work if I change min or max from its previous value.

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

                      LindonL 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @d.healey
                        last edited by

                        would fit with what i'm doiong @d-healey said in Is it possible to change default value after on init?:

                        @aaronventure Yeah it will be interesting. I'm finding in my real project it's not 100% reliable still. Sometimes the default value doesn't get set properly. Could be a bug in my script, but I don't think it is.

                        Edit: Seems to work if I change min or max from its previous value.

                        so that would fit with what I'm doing - which is changing default along with a bunch of other settings including min and max...

                        HISE Development for hire.
                        www.channelrobot.com

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

                        23

                        Online

                        1.8k

                        Users

                        12.1k

                        Topics

                        105.2k

                        Posts