A Button that shows/hides knobs?
-
I'm almost there....
With this current script, the UI initializes with all knobs hidden and button 1 + 2 are set to off.
I can toggle between Button 1 and 2, which shows knobs 1-3 or 4-6.Content.makeFrontInterface(600, 500); const var Button1 = Content.getComponent("Button1"); Button1.setValue(0); const var Knob1 = Content.getComponent("Knob1"); Knob1.showControl(false); const var Knob2 = Content.getComponent("Knob2"); Knob2.showControl(false); const var Knob3 = Content.getComponent("Knob3"); Knob3.showControl(false); const var Button2 = Content.getComponent("Button2"); Button2.setValue(0); const var Knob4 = Content.getComponent("Knob4"); Knob4.showControl(false); const var Knob5 = Content.getComponent("Knob5"); Knob5.showControl(false); const var Knob6 = Content.getComponent("Knob6"); Knob6.showControl(false); inline function onButton1Control(component, value) { Button2.setValue(0); Knob1.showControl(true); Knob2.showControl(true); Knob3.showControl(true); Knob4.showControl(false); Knob5.showControl(false); Knob6.showControl(false); }; Content.getComponent("Button1").setControlCallback(onButton1Control); inline function onButton2Control(component, value) { Button1.setValue(0); Knob1.showControl(false); Knob2.showControl(false); Knob3.showControl(false); Knob4.showControl(true); Knob5.showControl(true); Knob6.showControl(true); }; Content.getComponent("Button2").setControlCallback(onButton2Control);
The Only thing I don't have previsions for yet is what happens when a button is unselected. For instance, If I select Button1, knobs 1-3 are revealed. When I hit Button1 again, the button turns off, but knobs 1-3 are still visible.
Would an IF/ELSE statement work after the callbacks? or is this something I need to set in each callback? -
@dustbro http://hise.audio/manual/VideoTutorials.php ;)
-
- Use the
radioGroupId
property for mutually exclusive button groups. - Check that the value of the callback is true before you do anything (the callback might get fired for all buttons with each click, but only the active one is
1
). - Use an array to store all elements in a page
- Use a dedicated function that you just call from your callback.
Check out this example, which should do what you need in the most recommended way:
HiseSnippet 1235.3ocsWssaaaDDcosoSDSUPBPerOrvOIA3pHJeoEnvnNVNNPH0NBUtFEnnHXE4JyshZWgcWZEUCCj+u9Izeh9GzNKuHRYKoXFWym3d4LyYNyr25JEdTkRHQVO67oioHquxt2TtNnc.gwQcNFY8b6S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ykf9DzLfxtLPaZ8MPKEbhcGdWIEVBZN3WR7Yh2JEQiyphJCIZsTRb9+WjXyOa85RnvmHKiBMSxu2aWDGk1V+Ef5wv76jX9gVeYl+Ie1UFEMus0eCvWgouJauHq0KiW1aNM5wxK6emjco7zcukLbWcgeTHQO+E3MO5Ic.X+84tor41vbESOs3ihJws5atva0uvsuumz8k1cYZufEy20V.eg8kdr4a5ajpZ+lACnd5bxtg8I+5W5ChJAU9YQjlwu7ThVxLElmEMpG7hSOJvDNmFpLkGqYVHkztoosQY5Q49Myd+X5ftl1VoC5lMHZDwSJ9P1Ke.Q8ow8.bhG+V1Jvipg13YmnZ38H3ogevyyHDeKv7EinUoQrSoQraoQrWoQreoQ7ckFw2uBDl2g+5HsXTxxBD5+r0WLdC
- Use the
-
Dear @d-healey can you make an example, I really don't know what to do :)
-
How can we add a phaser modulation tempo sync assignment to this button? @d-healey @Christoph Hart
Content.makeFrontInterface(600, 200); const var button = Content.getComponent("Button1"); const var knob1 = Content.getComponent("Knob1"); const var knob2 = Content.getComponent("Knob2"); inline function onButton1Control(number, value) { knob1.showControl(value); knob2.showControl(1-value); } button.setControlCallback(onButton1Control);
-
@christoph-hart total noob question... what do I do with your HiseSnippit? is it a link of some sort?
-
Select everything (including the HiseSnippet part), copy it into the clipboard and choose File -> Replace with clipboard content.
This is the recommended way to share little example patches in HISE as it contains scripts, control properties, modules etc (but no external resources like images or samples).
-
@christoph-hart :love-you_gesture_medium-light_skin_tone: :love-you_gesture_medium-light_skin_tone: :love-you_gesture_medium-light_skin_tone:
-
My modulators' name is PHASERLFO. I've first used "Synth.getEffect" to predefine the modulator. After that, used "setAttribute" in "onButton1Control".but it says PHASERLFO was not found. What am I forgeting?
Content.makeFrontInterface(600, 400); const var button = Content.getComponent("Button1"); const var knob1 = Content.getComponent("Knob1"); const var knob2 = Content.getComponent("Knob2"); const var PhLfo = Synth.getEffect("PHASERLFO"); inline function onButton1Control(number, value) { PHASERLFO.setAttribute(PHASERLFO.TempoSync, value); knob1.showControl(value); knob2.showControl(1-value); } button.setControlCallback(onButton1Control);
-
@remarkablex It needs the name of the variable not the ID of the effect. You've put
PHASERLFO.setAttribute()
instead ofPhLfo.setAttribute()
Generally once you store a reference to something in a variable you only ever need to use the variable name from then on (not always true but mostly).
-
@d-healey
Oh, I've pasted wrong line. But even we put "PHASERLFO" it doesn't work.HiseSnippet 1169.3ocyW0saaaCElxNZswctXcqWtKDBv.bvZMjcyx9IXnNwItyH+YTmkUfcQGsDcLgkH0jnRpWQAF1d.106oXuC6gYWu2fsCEokjSTbr6V6FuHw7b32gemCO7bn5ExcHQQ7PjwcNYR.AY7tl8mvDiZOBSYnt6hLtq4g3HAIzRIZmIA3nHhKxvn7SjBLVcETx3Oe7NXOLygjIBgNkScHGP8ohLoAs1m540A6RNg5ma0azpqCm0l6wiA9T1zFEfcFiOibDVtrRlnyojKhPF1lOpY8vwMF7CaWWNFJ+yypOcz6II+aOoljEfbhCCILwo.bjgoweACCy8boBdXeAVP.atxNb2I8Gwufo15SoQzAdD4jFn9.mTh6v8bkNuTJp8HpmauogvHDXkdYAzxp.58MOj5RSkmEXeuDEVYHxGZMJMO503lomcQzyHG8VQQu6Y12IjFHxzH41cL6xfy7gX3zLOsTqEU5mKY1lCqfIp6iGS5DBSRQTaSa6GXsgs85aUsR0JvYZjv5bbn0fXgfyr9RqoXOiHZy8C3LXRs01IQci0jvx.MlwGz3ZwruTaAHZNWDMuDhde01826oGz4X.UR5uDydCGRb..oJWS4OUqPYdTFwZXLyQPAGhyzTWtigbuZrX+AjvG.11Klrd0JurZEK8H0Z0iHhsEhPJDUH0xDeBAnJPBmov2JCbh2VOBRCltSEtjlyrjFOTuHo5pUdkzCTmDRJnWUarm2.31VsK6KJeNmqdDWPNlUa8JurxpUd0UzLbXQpzFyiDVjVYYfv4.6RwS85fT3Yui7NK1cDGUZQtExYcYTwwAD874eIGoyqf6Sk0DD9kH41zc02lTwPDELxpl5.JJg84KNhtN388ntjvD32xL4P+eB3lE.9q6tKVfkkDzdC3gAjPAUFHM1kbNT1VUfXUycIQiE7fD2UeMBB1KfC+BYw1eB1sIxerE7iKnthQxI+HLYDgd1Hgb1Gp7mqy3EDNRL8WL0z+10aZ6kzzMUldeCso+8avzWshJTWm6F6gEyVrW1rTq.RtmopprxIKhJljuY5RzAvdgaPsnz8dl8nBmQEy2REvWHS5MMe08SqZpJLmQ1UL67r2xMOu0z6F8FgiHv1K4QE0LqKwlNgjuOlvblzHKbMoUpzlYR+0VcHDWYYXsrua3v+3wGRewL4Ekm04JuXN2h8ZfBSFdese8FJ6807HnphwllPSS8aVRahdy7KM7mI71sjOIsa1KZa8Ks9F74jg7Pe8wcJ7CHmAwn7RRaam+NQeeNWLhxNa1G5d+VGv4A6wvPDvMuQZGGI39S2TjwGY1bi5yNN+X4yZ+X4O+71IyQ8Ejfjp4Feq4lWd8+aMtx86W+7tRKXd2GHOZsRO9j4e+Ourohwo4V+Wx3mxiEPh2gX3ElxNZGE62G9tJGBvVFi3EI6fUR1aTM2VNOImkvbsm9URZkMjyMzJaLU4ak8vG6Dxeti5sNxrmamHA7aVxWEtJ74ovbqzWHIiM9vGV8bGGYqgGBQmhQzboQ7nkFwFKMhOYoQr4Ri3SWZDe1bPH+J1sig5VpVCHzeCf01RwA
-
@remarkablex Well the error message says
PHASERLFO not found
this should be a hint. The thing you have called PHASERLFO is a modulator not an effect, the effect is calledPhase FX
. If you want PHASERLFO you need to useSynth.getModulator()
. After you've done this you'll get another error, but I'm sure you'll be able to solve it ;) -
@d-healey @christoph-hart
Thank you, it gives unknown functionshowControl
. It's strangeshowControl
was working before but now, when we addSynth.getModulator()
it didn't work. I didn't managed to solve this....HiseSnippet 1188.3ocyW80aaaCDmxNZoQctXcqOtGDBv.bPaMrcyx9SvPchc7lQbRLpyxF1dniVh1lvRjZRTI0qn.C8KvddeJ12g8gYOuuAaGknkjcUbr6V6Fevv2c7G4u63w6n54ysHAAbej1sOepGAo8t58mxDiaNFSYnNsPZ2Q+Dbff3a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do2L+RB+oJuUC4iS6j911F+RiuAeIYH22Ucbm.uKYDDixpIo6c16D8c4bwXJaz7O48dM5x4dGwvPDvN6hzLLPvcmsoHsORu9tUleb4YvOCuu7ueVyHYTeAwKpvt12qu2hy+eqwqb+90OuqvJl28AxiVyjiOY92+yKaFy3jbq+KY7S3gBHw6DL7PSYGsSCc6CegkEAXKiQbBjcvJH6.GKWUJGkyRX1Um88RJi0jxZJi0lY7sxd3hs74O0J9YOxrmaEoA7aVz2GtE7gpfrYxikjwFW3Srdpkkr0vCgnS9Hpu1HdzZiX20FwGu1H1asQ7IqMhOcIHjeO6AgPcq3VCHzei2rckk
-
@remarkablex It's an easy one but I'll give you the answer, check your spelling, don't mix uppercase and lowercase variations. If you call your variable
knob1
don't try and useKnob1.showControl()
. -
@d-healey Thank you brother, as I say, I'm a beginner to coding. It's so hard to be a beginner sometimes :)
Thank you for your help... -
@d-healey that's how I got up to this point :)
Your teaching skills are much appreciated!