Slider value display - customisation
-
Can anybody see where the mistake is in my edit of the code for this? It compiles but the value isnt showing up in the label for some reason. It looks right but I must have missed something
// Speed Knob Value Readout Label const var SpeedKnob = Content.getComponent("SpeedKnob"); const var SpeedKnobLabel = Content.getComponent("SpeedKnobLabel"); const var NoteArray = ["1/1","1/2D","1/2","1/2T","1/4D","1/4","1/4T","1/8D","1/8","1/8T","1/16D","1/16","1/16T","1/32D","1/32","1/32T","1/64D","1/64","1/64T"]; //-------- Custom Popup ---------- inline function onSpeedKnobControl(component, value) { //if slider is moved, show label SpeedKnobLabel.showControl(true); SpeedKnobLabel.set("text", NoteArray[SpeedKnob.getValue()]); }; Content.getComponent("SpeedKnob").setControlCallback(onSpeedKnobControl);
-
@SteveRiggs said in Slider value display - customisation:
SpeedKnobLabel.set("text", NoteArray[SpeedKnob.getValue()]);
Not the fix but just something I noticed. You don't need to put
SpeedKnob.getValue()
you can just putvalue
.What is the value range of the knob?
-
@d-healey Cheers dude. Just changed that bit. Still not showing up though yet
The range is 32 as it's set to the tempo-synced speeds of an LFO modulator
-
@d-healey Snippet here if it's easier to see
HiseSnippet
-
I looked at your snippet and I found the problem.
Here's a simple test you should use all the time for everything,
Console.print();
Put this in your callback (obviously with something in the parenthesis) and when you move the knob you will see that nothing appears in the console. This is the first thing I did. This tells me that your callback isn't being called. The usual reason for this is that you have the knob linked to something via processor/parameter ID in the interface designer. So I checked it out and that is the case.
The processor ID system overrides control callbacks, so you can only have one or the other.
You also made a little typo
value()
instead ofvalue
. -
@d-healey Ahhh thanks! Typo removed.
I don't think I've ever used a hardcoded way to link UI sliders to module controls yet. I usually just use the processor id. Where would I need to start for doing it this way around? I'm imagining something like this? (but probably wrong, like usual)
inline function onSpeedKnobControl(component, value) { local SpeedKnobValue = SpeedKnob.getValue(); if (SpeedKnobValue >= 0) { local index = 0 * LFOModulator1.Frequency; LFOModulator1.setAttribute(index, SpeedKnob.getValue()); } if (SpeedKnobValue <= 0) { local index = 1 * LFOModulator1.Frequency; LF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CxRRh58Ila2lTUXF9WC+E9UvbUTPdyQo6m.WhAptjpLaMgNAJkdgPd452Y9ngmnTgGK4XZvqt8SWviMSTHOTcbMJIVqBJvRZ40A6XR6oo+F6oGzCel+Ul2e2H70SN+CyZx6VJad2Jkan703N1t8vzJYYIyTS+f1w0eicbC1D+y6EhK6m9e.huOapP6tXyyzM1.dIjO53M+S3ZyNd9bvUWA1cXi+0s860dOfxOqRz3b5objh0vieVRfC9Est.hDoD7iMT5MLyhYq6WPw6.RuzE+C9jqbfYMMW4fBkj.taj50tY2kYFJ9zTIHljoeqbK7i1w01CJtAiw52qu4ZCwqccMohuFw9l84wagOOYK74fsvmuYK74oagOe6V3yytUeL+sgmmfbuYiInfoGmw5RKYuoMI+K.ZIaZp
-
@d-healey Thanks man. I've just edited the slider names and added it into my project but I'm getting a couple of bad errors now. My interface preview has disappeared and there are some duplicate declarations. I tried removing one but it still won't compile.
HiseSnippet
-
The error is pretty clear
Line 74, column 11: Duplicate const var declaration.
Go to line 74 and remove it because you've already got it somewhere else.
-
@d-healey Doh. Last time I did that just it threw me another error. Compiled this time :)
Still no value in the label though. Pain in the ass this one is lol
-
@SteveRiggs
Console.print()
-
@d-healey I'm not sure I'm putting the Console.print in the right place. Still just getting errors. Tried it here and in the onControl callback
//Link SpeedKnob to LFOModulator1 const var SpeedKnob = Content.addKnob("SpeedKnob", 248, 15); SpeedKnob.set("text", "Speed"); SpeedKnob.set("mode", "TempoSync"); const var LFOModulator1 = Synth.getModulator("LFOModulator1"); inline function onSpeedKnobControl(component, value) { Console.print(work you bugger); LFOModulator1.setAttribute(LFOModulator1.Frequency, value); }; Content.getComponent("SpeedKnob").setControlCallback(onSpeedKnobControl);
The error:
Interface:! Line 83, column 24: Found identifier when expecting ',' {SW50ZXJmYWNlfHwyMjc5fDgzfDI0}
-
@SteveRiggs strings need to be in quotes
-
@d-healey I see! Thanks. Well, it's printing to the console now when I turn the slider. I still don't understand why it's not showing the value if that's working now. Head boggler this one Sorry about this
-
inline function onSpeedKnobControl(component, value) { Console.print(work you bugger); LFOModulator1.setAttribute(LFOModulator1.Frequency, value); };
You're not setting the value of the label in the callback function.
-
@d-healey Oh shit. Sorry. What should I put in there? Confused a bit as I already have this above...
inline function onSpeedKnobControl(component, value) { //if slider is moved, show label SpeedKnobLabel.showControl(true); SpeedKnobLabel.set("text", NoteArray[value]);
-
@SteveRiggs You can only have one callback for a control so you have to make sure all the action you need happens in one of those callbacks you've declared already and delete the other one.
-
@d-healey Thanks mate. Just moved it down and it's working now. Saved the day yet again. Nice one. I'm gonna have to start crediting you on my plugins at this rate