Knob is selected? use for function
-
Mouse callbacks are just for panels, but you want it when the knob is moved, so just a standard control callback is all you need. You should be able to get all the info you need from this thread - https://forum.hise.audio/topic/1443/single-button-that-switches-between-multiple-panels/16
-
@d-healey Thanks!
Here's what I ended up with:HiseSnippet 980.3ocsVEsaaaCEkz1JK1ctXAne.B4IGf1.a0ztADTjrXGWXzkTi5th9VAiDcLQjHMjnypQP.5mx9T1GP+BJ5K8g899CxtjTxRxQwwZXUuXy68dt7vit5d4vPgKMJRDhv0e67oTD9GsFMmKmzcBgwQC5gvOz5DRjjFZaLcz7ojnHpGBiq9RkAb8ZH8y+bvQDeB2klZBgdmf4R+MV.SlZc3guh462m3QeKKHSz6c3.WAuqvWLC3SUq1noD2KHmSOknBqhEBuwwdLoHbjjHoQPLGI7lOZh3O3l3eGKhclOUsnCZDjHiYT2ILeugIm0HDBWaX5Iup4j+HqSXdrE1SUfeR6vNEQVM.WIOkpkiRctKJ0W36oRvcPObF5UyPusrF4FxlJS8n31CrFvgWNiIfrmkVlXQU9RUqtBHBtb2.xEz9gvhEHZsW61O11oc6c1uYilM.wORZeIIz9UbwYcregcBzyoxthfoBNrn01ZuaqvjGgyJQ3rsYWxhZHgS8u6Mx3docRazY0XR2KF2mwo1imwckLA2Vv0rWgMT32xMA3igb6OitSyFW0rQc1X6VIqsgmqL+ndLbZ2H3MbRRjgPf6uTHN4BYLwOBhQGx0lHofk0I6wPSiIIIWqOhq7UztQJq57zk36eF74Tq7Jvp0Im+W0oacRJPnLZ45oSqThuO0wYUpiSF0IijbpPReMu0NMtpQ8FW2vdYWiGWnu3j4SCKzspIX3p.1hOK3LZXhzmDHzYHeqmGrdsdbMZRl.E7Abl70SowqSaNo7YN0IdaiVbXyZJ8Ll0p9nUPXoltcuOT76LnKXk3vgPk5dfOLtG3HelGMDw.N9CV5xYjVahmk7mu7ae4.zZC1IG3+5ye9qGf98A8HRhpSbLc.JNkFJYJgF2idILVyzWttUOZzERwT38whZL3+2Ki+HBag2G1w4KFA9od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D2LlL.GDkwFcLuaDAheA4FQ8cbpCKwX.RmVNzHmHR.wSP7qmFk5G2oGSfYbYX2btNdRtSkuKsmVxOy7zAGDbAr+SirkB4DGm5VJiWX00cYqttkWccWb00c9pakUL4UPsMe4urRqatR6xUPKrWZYKitkTFcmuL5tLFOqxwYmwEjWxZrc0aqVo5cUcxqZvfB0Y7P.IrP0xSBCKCXC1jQWPBi6PhMDNdH64OOd4N+wSm9RYHmcBiJd4XhYbxITRc5nNVaSzrfMsnjXLsTUnUfYIhl+.Pjo7BGEZaLGLUnNH7IlCB6GP8IgHJvwOvVs9EoxMlKTz9O+0e6YnkFraFvu+u+geewf0MNJvUrMaFjAt51PqBb27vMofzvqYfqVtoP+Ha8RuXvehcg6nhP+zIGgEX48JL4UHWOlDJnxNFqiHWCWRSeKiJ1GQhtRvGC4kYqqflrGL0eCTor1Gn8zYAw6OpMJ0bXmMLTKwLggdiH8brkUt4fJHizWJzEDuYWz82axOKM8byPOaKQN7a9.TyMC0z3yQq+xPqqiWuYsdAdnzNnaRJ+61NIEf991uk5KFJc7mBCGRnWNTlOsbJNLJsOKkSZlxIN+RhS9rLN4o4bh8C1MlxE+b533oskmNTRa57W5Et5M2eR.Vj893xGdXT.aRl4huxK2xhnhooWJtBWRuYgWRuUQ6QsjzcK6dTg2vh46ZEvWXc5+2707jmZ1GOX.j7SH6F1ce8+022rBT4G4SDT1kmhEgT4RqylLpOrRxiX5LhjcdqIa7ziaJGKyL8ILe0f6gOixVxwVFkshUhFg8B4uwSuKp7QUORIA3DS8dxJvCagwNy19Tx6QvK8dimmLQ74.yKFg6Ji3KVYD6sxH9xUFwWsxH95UFw2TBB4yp+1IB9H8xBPPuiUGTYYcLCCcUpNPz+Bw3mjAC
I've added buttons to the control callback and used this logic to show a panel whether the button is 0 or 1
if (Knob1.getValue() == value || Button1.getValue() == 0 || Button1.getValue() ==1)
Is there a smarter way to do this? If I wanted 20 different elements to display a specific panel when selected, that line of code will get pretty long :alien_monster: :alien_monster:
-
@d-healey Is there a thread or tutorial on how the Timer works?
Once a panel is revealed, I want it to disappear after a set period of time. -
Nevermind...... I'm tinkering and this works :)
const var Panel1 = Content.getComponent("Panel1"); const var Button1 = Content.getComponent("Button1"); const var panelTimer = Engine.createTimerObject(); inline function panelTimerFunction(component, value) { if (Button1.getValue() == 1) { panelTimer.startTimer(2000); Panel1.showControl(false); } else (Panel1.showControl(true)); }; Content.getComponent("Button1").setControlCallback(panelTimerFunction);
-
In the meantime I was making an example for you so I'll post it anyway :)
Panel's have a built in timer object so you don't need to declare a separate timer variable in this instance.
HiseSnippet 1313.3ocsW8laaTDEeVmrg5EbEUhCvH+ghsHswtzV.EEgINIEKZRspSS4CHUFu6X6QY2YVM6rI0DEAbS3nvgfC.GAtAk2Lytd2M1ApQh8KIu279yu2el487PovmljHjHm5mNOlhb9H2Qy4pY8mQXbzfCPN208XRhhJwVV6OOljjPCPNNa7LMCm5ahLe+0WuOIjv8oErPnyDLe5yYQLUA2g89NVX3Qj.5ornRR+3dC7E79hPQJfmMb6fhI9mSlROgnEqlKxYqCCXJgbjhnnIfL6KBlOZl3RtU9yXIrwgTMQWzHvPV1n9yXgACyi0DDxYygEQ9F1H+SbOlEvVvuHC7wlCvEZTNG3TqJj1rBj5daP5HQXf1.2B7bJAuMsv6dti7krXUwIZr8gtC3PwYBAR6kgkUVTsey0su.jfqdXD4b5QRfXgFsdZmNaieRmNs2sgWCuc1YDUgUyn3PxXZ3mlfUz2pvBNlwYpFd4FZJU0WDEK3.QqlOWKa2lseXBEnzZzbabyNMys4y.aRvR5DpjBMGXkv3hKYAfcvO.OjvA8a3Ak9DE9BhLiCdO7pcn83l2DywZ1.l0XkQBAKElRK.uUKMHOSePqJwbZrwDDeECTPMin.7EFhE99oR7kP4gVwGJnuUhYIXYJmy3SKadcOsrOILbLz71ZRJ2XzVswW0vCq+r+YmcdUB8F.GJK7EHmj.oMHcvHiCMYMeQJWgmHEQ3NZ5tcrV5lQVF8zb513OC2UGskc9Arj3Px7J.v5WFG7qoAvJ6ZT0Wxy4dEWIve8LJ23XSDAIRIk3OilrHhXSvqHJ1aOPf1VItpvt4gObkSCUoHr0DRXBs8tfq9VVPoj7xJoDwl5UKizi.Riz15a1mQoq8tdEMLiSUJngwOqZ2viwCYbJNupCseiUb3oAoJGa944vss4anuHKwDJ.6fkvyHPqOboTiHC3r7f5RTR4h35dcDL2Ko.2J2tq1BUJGpjo1T3RcJqtqqSIGTp11vq9hbMjErIac7jkvAdU5AGmxBU5X0TBZ3csIou5PMO0ZC1Lfu3l2Ro916VprbhPQeAbqz6Ju5dW6cySlLYUGkYnPc+xxml0Hcqp0hmFMlJyq6YxAuuWc.xVueCP7sojRBJ3CfW5dQLMitXDS2ULhAkkS0Cax.HHpxLpoQ1nFSuDhA13Nt19JjA6vH6s7xmv+pAGPTjby.VD7RLUpX5fw4.5EvB.1IX0cOflbNbGClkunLhb9.qSualS22bmx3UO27RH5sHGWm8.2MW+OaC+it60.USOjI4iRHWPGvGJ0cg5ofrjiEQfSHRPMmZnRd0qZnZZRyBUaCq1kYal7m+Xu4KH9kfdvrK0LMNBbPnYT1zYJM0e.mNdZ99K02Bg15cZMXJZTA26e+e8FbeTY1WjWtgUKbJg25+qklB716GJg2e+zdwDXzqpjwVDiSfR1H1OUZIrupH59YT4nq6hbdoh+xqo.KKIBRCIppaPoWUL6.3RQkUUzqivSXp4kWkbMVqpyJWqZk87umv8dtCYJ+YqFu0VAdgt++uwa1RpMbObxDpup.ra5dz2+eciz0.JuTjpfMcNlnjL8kwSRiFA8t9T.IbnWJQ2iTS+thktilVmYFQ4AFh2AeYG1US6jcX27CQQDeo3M91WizqAeGCG.Sbyu.nN7SQ.Z7hmgz3NB1M+M995DwC.juZMdzZqwmu1Z730Vimr1Z7z0ViuXs03K+GzP+Cg9lTkHxds.XL7Pyy+NNGx0KpZ5.Q+Mr.R9mA
Content.makeFrontInterface(600, 500); //Set the label's text on init Content.getComponent("Label1").set("text", "0"); //Get a reference to the widget - Panel1 const var Panel1 = Content.getComponent("Panel1"); //Set the panel's initial value on init Panel1.setValue(0); //Set up the action that will occur while the panel's timer is running Panel1.setTimerCallback(function() { //Use the panel's internal value as a variable to count from 0 to 10 Panel1.setValue(Panel1.getValue() + 1); //Display the panel's value in a label Content.getComponent("Label1").set("text", Panel1.getValue()); //When the counter reaches 10 if (Panel1.getValue() == 10) { Panel1.showControl(false); //Hide the panel Panel1.stopTimer(); //Stop the timer } }); //Set up the button callback inline function onbtnStartControl(component, value) { local rate = 500; //Timer rate in ms Content.getComponent("Label1").set("text", "0"); //Reset label's text Panel1.showControl(true); //Display the panel Panel1.setValue(0); //Reset the counter Panel1.startTimer(rate); //Start the panel's built in timer }; Content.getComponent("btnStart").setControlCallback(onbtnStartControl);
-
@dustbro said in Knob is selected? use for function:
Is there a smarter way to do this? If I wanted 20 different elements to display a specific panel when selected, that line of code will get pretty long
Yes. Use arrays and loops. I've demonstrated this in a few threads now so I think it's time I make a video about this.
-
@d-healey said in Knob is selected? use for function:
Panel's have a built in timer object so you don't need to declare a separate timer variable in this instance.
..woah, I didnt know this. so if I have (say) 10 panels they can all have their own timer running at different rates?
-
@Lindon Yeah but if it explodes let me know.
-
@d-healey lol
Wow this product just gets better and better...
-
@Lindon Yeah but if it explodes let me know.
You should be fine with up to 100 of them per plugin instance.