I got a bug report for my plugin from a tester
-
@Straticah if the SYNC2 switch(es) are saved in preset, i think you could just do something like this:
} Knob7.setValue(GRAINS.getAttribute(GRAINS.SpeedL)); Knob8.setValue(GRAINS.getAttribute(GRAINS.SpeedR)); Knob7.repaint(); Knob8.repaint(); }
and it should be fine, if that doesn't repaint use
.repaintImmediately()
to make it asynchronous -
@iamlamprey its giving me "function not found" anything that i might be missing?
-
@Straticah just call the correct method (repaintImmediately() for panels and sendRepaintMessage() for everything else) for each component that you're setting the value to.
When changing the component value in any way other than the control callback, LAF or Paint routine won't update itself manually.
So you either have to call repaint or you call control.changed(), which also executes the callbacks of these controls.
in your example, you seem to be missing these calls after setting Knob7 and Knob8 values. So just call it there
Knob7.sendRepaintMessage()
Knob8.sendRepaintMessage()
-
@Straticah yep sorry, it's sendRepaintMessage()
Knob7.sendRepaintMessage()
Knob8.sendRepaintMessage()
-
@Straticah I get the same bug using the HISE default delay as well. Everytime I recompile the sliders are reset to 0
It's probably a Hise bug and I can recommend running your own scriptnode delay
-
@oskarsh ah good to know, but in fact i am already using a custom made ping pong feedback delay that i made in scriptnode. The sliders are connected to the tempo sync node and an input toggle.
-
@Straticah are the sliders set to save in preset?
-
@d-healey they are, since they can have two modes that are overwritten by the script do i need to set saving in preset inside the script aswell? -and if so how
I just saw that this bug only apperas on one of the two modes.
Currently i just select the element and enable save in preset within HISE.
-
This post is deleted! -
-
@aaronventure this worked just fine, unfortunately it did not fix the problem.
On startup it still shows 0 as the delay slider value when saved in a project.
It appears to be only for the unsynced state (time in ms) value tho.
//2 //Sync Unsync Button const var SYNC2 = Content.getComponent("Buttonsync1"); const var Knob7 = Content.getComponent("Knob7"); const var Knob8 = Content.getComponent("Knob8"); Content.setPropertiesFromJSON("Knob7", { "mode": "TempoSync", "stepSize": 1, }); Content.setPropertiesFromJSON("Knob8", { "mode": "TempoSync", "stepSize": 1, }); inline function onKnob7Control(component, value) { GRAINS.setAttribute(GRAINS.SpeedL, value); } Content.getComponent("Knob7").setControlCallback(onKnob7Control); inline function onKnob8Control(component, value) { GRAINS.setAttribute(GRAINS.SpeedR, value); } Content.getComponent("Knob8").setControlCallback(onKnob8Control); inline function onSYNC2Control(component, value) { GRAINS.setAttribute(GRAINS.Delay_Sync, value); if(value) { // Switch the knob to tempo sync mode Knob7.set("mode", "TempoSync"); Knob7.set("min", 0); Knob7.set("max", 1000); Knob7.set("stepSize", 1); //Knob4.set("middlePosition", 250); // Switch the knob to tempo sync mode Knob8.set("mode", "TempoSync"); Knob8.set("min", 0); Knob8.set("max", 1000); Knob8.set("stepSize", 1); //Knob4.set("middlePosition", 250); } else { // Switch the knob to frequency mode Knob7.set("mode", "Time"); Knob7.set("min", 0); Knob7.set("max", 1000); Knob7.set("middlePosition", 500); Knob7.set("stepSize", 1); // Switch the knob to frequency mode Knob8.set("mode", "Time"); Knob8.set("min", 0); Knob8.set("max", 1000); Knob8.set("middlePosition", 500); Knob8.set("stepSize", 1); } Knob7.setValue(GRAINS.getAttribute(GRAINS.SpeedL)); Knob8.setValue(GRAINS.getAttribute(GRAINS.SpeedR)); Knob7.sendRepaintMessage(); Knob8.sendRepaintMessage(); } Content.getComponent("Buttonsync1").setControlCallback(onSYNC2Control);
-
@Straticah I think we need an FL Studio flag
For real, tho, you can call Content.callWithDelay in the init, set it to like 100ms or so, where you both set the knobs to their current values and repaint them.
A silly fix but hey...
-
I had an instance where a function was running before a variable was calculated, so the knob was set to 0 (undefined).
I had to use callAfterDelay to set my knobs like this:Content.callAfterDelay(1000, function() { if(myValue == undefined) { myValue = myKnob.getValue(); } }, this);
-
This post is deleted! -
@Dan-Korneff Hm i could not get it to work, where should this function be called?
I assume the value refers to
GRAINS.SpeedL
and i wantKnob7
togetValue();
-
@Straticah the idea is to call this method in your on init callback so that the function in there executes after on init.
You can call your repaint methods in that function to see if they reset the graphics correctly.
If they do, you have some value setting call somewhere that does not refresh the interface. Add some isDefined(checks) when setting values.
But at that point, if it works with no drawbacks, you can just leave it like that. It's ugly and hacky, but it's an edge case.
I shipped worse.
-
@aaronventure @Dan-Korneff it did not works because the script is taking the value. And the value in this case is a variable it has two scales, and it usually takes the 0-18 scale which is not the one i need. (im also a true beginner when it comes to these types of scripts)
inline function onSYNC2Control(component, value) { GRAINS.setAttribute(GRAINS.Delay_Sync, value); if(value) { // the callAfterDelay script takes this as GRAINS.SpeedL Knob7.set("mode", "TempoSync"); Knob7.set("min", 0); Knob7.set("max", 18); Knob7.set("stepSize", 1); Knob8.set("mode", "TempoSync"); Knob8.set("min", 0); Knob8.set("max", 18); Knob8.set("stepSize", 1); } else { // but this is needed in this case Knob7.set("mode", "Time"); Knob7.set("min", 0); Knob7.set("max", 1000); Knob7.set("middlePosition", 500); Knob7.set("stepSize", 1); Knob8.set("mode", "Time"); Knob8.set("min", 0); Knob8.set("max", 1000); Knob8.set("middlePosition", 500); Knob8.set("stepSize", 1); } Knob7.setValue(GRAINS.getAttribute(GRAINS.SpeedL)); Knob8.setValue(GRAINS.getAttribute(GRAINS.SpeedR)); } Content.getComponent("Buttonsync1").setControlCallback(onSYNC2Control);
is there a way to double click the sync unsync btn: in this case
Buttonsync1
twice on loading to refresh the state? i know this is quite bad but this vst has already been sold and i am not able to change this setup into two independent sliders (which has been recommended), i would have to redo all presets and the users could not use the new vst version with their old projects. -
@Straticah said in I got a bug report for my plugin from a tester:
and the users could not use the new vst version with their old projects.-- this case is exactly what the pre and post preset callbacks are for...