Is it possible to change default value after on init?
-
@d-healey said in Is it possible to change default value after on init?:
HiseSnippet 924.3ocsV0raTjCD1dx3.yrKnEDO.sxoIRrQyvuq.gRHSRPifDFQGh1aHmtcmwZba2z1Mjgej3.uDbiCblWANyiA21i6a.aY2NS2AlMDFI5Cs5xU8U0mKWU4dXtJho0pbDt0tSxXH7uSBmHMi5OhxknAafvmmrMUaX4AkKs9jLpVyhQX7B2yt.tUSj64eWccpfJiXUKgP6o3QrGvS4lpUGt184BwVzX1t7zZVes0FDoj8UBUAvmEHcQYznwzCX6Psl0ffvKtYL2nxCMTCSC1rtJdR3H0ykk1uGWy2WvrB8PgfiJWF0eDWDO7n8pFgvMGVsyWnbmeIx17X9z0qx.+gSQPEh54.biShR89InDtFkZVRoKPBix4YlJMV97ajAR3.IgBo55TozVTiOfI8UfERyJozwrsxAgoH5bitcub.7Z4a2tMjt0lfmQyCtuTseuf6DbDvCXl9pzLkDD5rjS6RVDs4RAWxBRJjQFtRFnjqWXLJYOKxbknSzQvtL3XQAa41urcKmCVQy.eEyRnEBydVcK4sIX0ftqbkfaAuu40gv7ZHRylI9fszxVm4CYepPrOToz4a4B3oZ7bGkg8PYGGeZ+51AeqpjjYpy6KAKelpskv4mDvNxhz8Y40yFVCgy3iW3r3oqvIpLsTyPkbfjadXFyKukRDaKHre+8kYHedEJ3Z3YHXpwUtcde4VnfGyxQbvImg3N5PNx6aUe+6d2mWE8+At7HvAtEwedbL3kOOdvFTC0V16IDPxLVtgayE3MXOClaT1DzhrASO1nxbL1WIfvm6Gx4CqBnYsISEdySWSalXyrK5LDkxiiErgJM2dxUaf1mf4dYg7W3X9KuzGu2WdwaWMs9LODJkdX8Qf5hjD9gtgUIbQp1.baPJLCCguH4wZVfu7OPOF7CzJMlEuqxYe8FiJW9O1L8zMcySQtFhNA+J.5D6GOxMw86lr.yzTwEBp43C5rSz8Jroh5SWrSPjPJZR8s6Owzutm3zuSKEu.YH2DMZ1brwL3nsN+W.G82YbNxlIIrHSEAaR15um2KH9Ag+QpBCWdv1TnnxdHuSQZHbUYDChtTxDZ64cCaKdobWqrMCDxjwNguBOdk8rxXuxdGoDJmixUOIpr21dqzYcq.bR5tDtE72.fbvzVZBo6JcssP7mDEY29+YODZ1Xtxbf4pyAlqMGXt9bf4FyAlaNGX9qSDi8eStagQkV1N.KLbS2nULdSIEprbUgn+C7YG6D
very strange - I'm doing this in a combobox callback:
collection[i].set("defaultValue",sendfxProfileToUse.ControlDefaultValue[i]);
and its working fine...is it something to do with the init not being complete before trying this reassignment?
If you recompile it adopts the value last set by the button...
-
@Lindon Not working with a combo box here
HiseSnippet 927.3ocsVEtaaaCDlzIrcVcqnEXX+lH+xAHMPtNoa.EawKNICFsI0XpKn.EEEzTzwDghTShpqtCEX+XuD8e60X+auC6InuAEnO.sGojskScZGLVEfDvcG+N9cGu6nFjY3h7bSFB27gSREH7WRhlnsi6MlI0n9GfvWmbLK2Jxnkp1eRJKOWDiv309ImBby0Q9m2r29LESyEyUgPmZjbw8kIR6bsC5dOoRcDKV7PYRsUuS29bitmQYJ.9rFIDkx3myNSbBysrFDD9JGFKslrHKyJxQ3022DOIZr42zkq+TYtbnR3DZih.GUp9HiJ1wXmVTuwRU7fowcNB7xf4Yg0JyBeM4XYrbl94Yia3MPmind9.2XQ5s1Bzqcc5EVidKgR3ZTZ8RJcSRDOSlZmawwmqQ5qgCmQLHsWmJkqE03sXROCrBsc6D14hix.gYHZcmvvsnvmMuaP.j5yszmwxn2SaF1l98zo.OSX6YRRMZPn0Fdqa3PH0JoVPGUn4VoQScmcICM6addaGzLipEeJts.OqJDaF76AMUFNSQiEiXEJ6oN04vt83vsauEMb6a69zw8YG2mceBrSMkins7Nf9CzvMCZ1zyhsyE.gp6nM1ZQ+93RP2h19I.ieI3pkGTyH9Fa5bZE86wTpgPIXqOLx.uUKtOwXEOP2xGcAuLfdQSiFsTaU9RIxVpYW2Q1GCXKcQxPQV8bqagPIyh0gjKuNrdaBuL0TagFcesz9fTg9xZdPU4SnlsQEqfkZ8UrWuphMRIiEYHITXdUh+fC4IbUmOsSm+cOzEAeiJvSS7d3WiL6bXAW3m9f9k9GvrLW2SEo.hlJxrRWN.ef3YvnnxdoljCD4maModVWUE.SW9j794y2Pa2IyD9iesKLhLMR9hoLp6qewetW8RwJ8+0qd0e6B1Ktmexv8R14+Q0MgA1HXBHIshDHV+FBzKE.sRvaG3cG3c2.Xv6GLTAFmYhKTL6hy3bC1qL.EbKLXwM7PmKsSpm5+eav2+UJdSx.okOd4brwR3nq97y.Gqtt3qHGNZjfamSv0IG8nOO2Mf9YSgUpO6XlMS5N4OoHIBtwjKfcWqEJWCOtgq0rTNzI6x.QBcrW3cvSkw1NYbkw1SMhRX7LyS4k8jtKj9BuFfSZ+cwMgeJ.joyZCIPIWHJAta7obtK7uELsX4Xt8JfoyJfYmU.ytq.l6rBX91U.y28Qw39sjervZRJaG.ECNzONDiOTyfJKeUH58fmnHan
As with the button the property changes in the interface designer, but double clicking the knob doesn't reset to the selected value - also tried in compiled project.
-
@d-healey yes very odd - working for me in my project
-
@Lindon Is there something different in my snippet from what you're doing?
-
@d-healey basically no - Im setting up a data model where for each loaded effect I have a set of values I want assigning to each of the re-usable knobs, and this includes max, min, defaultValue, mid point, mode etc.
When the fx is selected in the combo box - it loads the fx into the slot, displays the used knobs for this FX (up to 10) and sets their params....
-
@Christoph-Hart Any suggestions?
-
@Lindon Are you using the latest version of HISE?
-
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")); } });
-
@aaronventure Thanks, seems like a pita solution, but it's a solution!
-
@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.
-
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
-
@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
-
@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
-
@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
-
@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.
-
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...