Slider value display - customisation
-
@dustbro This is really cool. I've been wondering how to do something like this for a while.
I just made an edited version below without the timer so that the label always shows the value :) I had a digital screen graphic on my GUI before where I was attempting to do that but I scrapped it in the end as I couldn't make it work. This should fix it! Nice one
I definitely agree with @Lindon though. It would be cool to have it built-in as a feature without any coding.
HiseSnippet 956.3ocsV8nZaaDF+jSzVs1bYE5CvgGLb.mD60zsBkwbhrcwzlTyTWXPoTNKcN9HR2INcJqdk9trWg8FrGo8Fr88cR1Ro0IqXHmQF8ce+6288uSS0pPdVlRSbZ9pkobhyW6FrTZV3ufIjjICIN228TVlgqoEacxxTVVFOh33ryyvMbZtKwt9me9DVLSFxq1hPNWIB4uPjHLU6NcvyEwwiYQ7WIRpI8QClDpj9pXUNfmcb6QRYgWxtfeFCEqgKw4KFEILJcfgY3YDmcOQEsLXg52kExetHSLKliD8IAfgJ1drJNBQLtKwegHNZ5pycFArxzpnvNEQgG5dpHRrd+pnw2XYPqznd7vowsAu90gWuOe34TCd6V.uG3FDpEolJNH19J2IRHQMmAof5vpPVRi+pgquBjPZNHgcIerFHVqQmG2qWW5Q85s2Sa40xCRDYF5ULM84R0r9zehtR0K3FeURpRBDcZa41F0oRiWvlwiuYUJX29i8yYJC+XslsDT70s8a2ss+2B+MDevWFAOiwGj3Y3C9xw3C9xIsei0f3uCOb+xEk5mmYTIzopz7TJc+0qBIExXgjSmmKCMBkjpj1CDBbsJtS3JT2EfXbNeuVduukGEVGdnXNMKVDAMFhLZh5JdTWZFjqow34ixjQzLCSanFnHW2xqYw49.TlU12nAa9zZ73P7wvemoc2p3wqsPBChmiXnyduwpRKuOXOv2ZdAsXoy7Ywwyf9oNW+Lh1p1wG85Kkc1y68dM89fG8iYMe9F4UZrXtdirw9b8soXGYdxLtdUXdkfPA+06nbu4Np5M7gEwjZBpjSjByKS4xapOiTFHwNtRTAhZr8a2ureKvlvIBns5KcsQQhEv0m3Q90ICYF1Jy.VD7RJWaD3AvYH+JXhXQabS2g7rKMpTX315bGLj6+0ouqxggCVVQDL.lTmFH9Cd8wxIrZx+cCHepqZU5JaYn0S2ysnjrlq9ynZt5umM.qSwfoOgC4HlMM3rC4SmVAyLUQ4wLy0Gjh2dTx.pEt1DKbpjLSXVV+XbmLc8yEtOvcpvDtXy3swFvKj+uqwa4cUsbGMeNOzTA1ccG+a28WLQ9EUtQHu3TlQKfxD2yxSBfqtC4.RjRdL1u5z.6rJn6gz1xTtLxR7uvpjYej1ojY+ULIIrPs5sgE8i3sg2ytCfIo8iBZBecBPSW2H5516fdjD3R52FFhgh8AruYc99sPmGsE5bzVnyi2Bc9gsPmebKz4I2pN32GcbNbmaQaBrwzQ1AhNNij3TBaEI4+.78bNKB
-
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; LFOModulator1.setAttribute(index, SpeedKnob.getValue()); } };
-
Here's a simple example
HiseSnippet 1077.3oc0WstaaaCElzNraVaNX8xCffAFfCVlgcaVWGFFlabhGLZtXLk1Mf8iBZoiiIrDolDUV7J5yvdU2av1g5taLxRMZ+wzODLOW34imKeTdZjxEhiUQDZqKVEBD5mybVI0KFsfKjjIGQn6xNkGqgH6LQGtJjGGCdDJs4OYDPasCI84u+wC49boKTIhPdkR3BmHBD5JoSG9Bgu+XtGbgHnl0GLbhqRNR4qRP7zj0mDxcWxuDNiaLqAiPu2wdBsJxQy0PLgtygJuUNKT+gLy9WIhEy7AyhADGbixDOV46YPr42jQKD9dSKN2wDbWlVkEZlkEdD6TgmnTdU13KRUXW4Q87AswsAuAaI7n0f2NYv69LG2HQntRiAaOLWZE5FrF7xzRZ7kMXXdNVaeEOxdoblSH.d1+f8HkTCRcOtm2KjpYc6Tnqy91C5uuc+8991VEx5EC5tczv0ZTamLyto9.kGXzeADDpvFK2TaZaUE+SFe9oJuDeNl2FffHs6q2kftTZ2NnM1UFkuEssDRegDrmmHc0BkzVIKBt4jDo765pvvJwyz9Xr7Sf8Za8l1VsVKlFf9bsNRLKQCcWW03H32S.o6pB+wH+1znWjqPfNpHH0RX6Y10bTLh66OCaj6dC7Y1tZn+LkFNW1cOq2X0x5sV1uqp4y2nt7MyGh1nZyLVzs4XWYRvLHp3HVXH1rsd2r0cqa1MKyTyPkbhTnOODJWmcRKjzmTd.qKp5bUWZ5wYClUI5liPj7pkYXJ2bzTc5nzt4CMN9BOHhHvIEKVQchjlRpymQd4ji3ZdwNgaJFnPHRKLoH5QvUHeW1PZK1QP7RsJL017dDjf8tD2qITF0BC2JyOLwMVuxjquGyLZRBDdd9vTUrvTKq.XmgHUcni3Og57xA7qqV93gyE9AwXCe3j.jbkPe.6kwfsGLmm3qsiWhTc3f0Rv6BUJqqYHmP+DVFzLizD5mwJGoQB8aPPgzjESQ04NMWXjqv.65jSSLIS73rpNv+3SntaFdYLbvOGjqy17eCxRRh58Ila2lTUXF9WC+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