Slider value display issue.
-
I am having this issue on sliders where it will not show the correct value at the lowest setting , strangely it "works" if I move the slider slowly, although it should go to zero and not stop at 1ms.
This is only a display issue as its correct on the corresponding module (delay in this case)
I think I have posted about this before but cannot find it.
Code I am using.
var PREDELAY = "PREDELAY"; const var Delay1 = Synth.getEffect("Delay1"); const var sliderPredelay = Content.getComponent("sliderPredelay"); var pred = createLabel(PREDELAY, "ms", 275, 455, 128, 22); inline function onsliderPredelayControl(component, value) { Delay1.setAttribute(1,value); Delay1.setAttribute(0,value); displayValue(pred, value); }; Content.getComponent("sliderPredelay").setControlCallback(onsliderPredelayControl);
-
Don't use var, use const or reg. - This won't fix the issue but is good practice.
Don't use Magic Numbers, use enums. - Also won't fix the problem but might prevent future problems.
displayValue(pred, value);
We need to see the contents of this function
-
@lalalandsynth My guess is that it takes too long time to update in your custom function.
What if you set the text at first in the CB?
I don't like to do this because to me there's a priority to set the values and the text comes after, as you did... -
There is a label created that can show the value when clicked.
var Labels = {}; const var TEXT_COLOUR = 0xFF9B9B9B; const var TRANSPARENT = 0x00000000; const var labelData = { "fontSize": 13, "editable": false, "bgColour": TRANSPARENT, "itemColour": TRANSPARENT, "itemColour2": TRANSPARENT, "textColour": TEXT_COLOUR }; const var buttonData = { "bgColour": TRANSPARENT, "itemColour": TRANSPARENT, "itemColour2": TRANSPARENT, "textColour": TRANSPARENT, "filmstripImage": "{PROJECT_FOLDER}transparent.png" }; function createLabel(label, postfix, x, y, w, h) { var buttonName = label; var labelName = label + "Label"; var buttonComponent = Content.addButton(buttonName); var labelComponent = Content.addLabel(labelName); buttonComponent.setPosition(x, y, w, h); labelComponent.setPosition(x, y, w, h); Content.setPropertiesFromJSON(labelName, labelData); Content.setPropertiesFromJSON(buttonName, buttonData); Labels[buttonName] = { component: labelComponent, state: true, label: label, value: 0, postfix: postfix }; //Console.print(trace(Labels)); inline function click(component, value) { var buttonName = component.get("id"); Labels[buttonName].state = !Labels[buttonName].state; displayValue(component, undefined); } buttonComponent.setControlCallback(click); return buttonComponent; } inline function displayValue(buttonComponent, value) { if (!buttonComponent) { return; } var buttonName = buttonComponent.get("id"); var o = Labels[buttonName]; if (value) { o.value = value; } if (o.state) { o.component.set("text", o.value + " " + o.postfix); } else { o.component.set("text", o.label); } }
-
@lalalandsynth Looks like a lot of weird stuff to me. You have a function and inside that you have an inline function, and inside that you're using
var
instead oflocal
Can you make a snippet that demonstrates the whole thing that I can load into HISE and untangle?
-
@d-healey Someone was assisting me that knows more about programming but maybe not so much about HISE.
I will prepare an example
-
@lalalandsynth @d-healey was thinking of implementing the same system into my project... watching with interest