How to use panels to switch between groups of samplers?
-
@cadrose said in How to use panels to switch between groups of samplers?:
functionality with one invisible button over the panels
Why?
-
@d-healey So the idea is when you click on the panel the image changes and each image represents a different set of samples Like so:
https://www.youtube.com/watch?v=kIcjBmqocYcIve managed to get the rough functionality of the ui thanks to the info youve shared, however im struggling with getting the one button to control the midi mutes in the same way its showing and hiding the panels
-
@cadrose said in How to use panels to switch between groups of samplers?:
So the idea is when you click on the panel
Why do you need a button? Just click the panel.
-
@d-healey apologies i'm not the best at explaining things.. Im using the button to toggle between the 4 panels which im currently using as background images.
the idea is the whole bottom half of the UI is one big button that will allow the user to toggle through different sets of samplers using the midi mutes. -
@cadrose Ah I see. You need to get the references to your midi muters in an array. Then you can use the same index you are using for the panels to control the muters. In your callback you want to loop through the muters and mute all except the one for the selected index.
-
@d-healey ahh ok with ya! thanks, this is very helpful!
do you have something on your YT channel that covers this?
In your callback you want to loop through the muters and mute all except the one for the selected index. -
@cadrose It's covered in this one (jump to the Scripting Samplers section if you don't want to watch the whole thing - but you might miss some context).
-
@d-healey Hey, Ive watched this video and many more a bunch of times, but I'm still struggling to get my head around (in your callback you want to loop through the muters and mute all except the one for the selected index.) I feel I may have bitten off more than I can chew for a first instrument idea.
Content.makeFrontInterface(400, 700); const var panels = []; for (i = 1; i < 5; i++) { panels[i-1] = Content.getComponent("Panel"+i); panels[i-1].showControl(false); } var currentPanel = -1; inline function onButton1Control(component, value) { if (value == 1) { if (currentPanel > -1) panels[currentPanel].showControl(false); //Hide previous panel currentPanel = (currentPanel + 1) % panels.length; //Move to next index panels[currentPanel].showControl(true); //Show panel } }; Content.getComponent("Button1").setControlCallback(onButton1Control); const var muters = []; muters [0] = Synth.getMidiProcessor("MidiMuter1"); muters [1] = Synth.getMidiProcessor("MidiMuter2"); if (panels ) muters.Synth.setAttribute(muters.ignorebutton, 1);
-
Here's a simple example
HiseSnippet 1311.3oc6Y8+SaaDE+bBtqIsisNUMse7JZRKnVAIgttIwpZf.TEMBjQnrIU0Uc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GAZDE7OOhF+iP6.9kTA0WW7pMkmg7Gy5yP7l4mgbnkBB+w9DQfmLHmi6RcYGCc7AYY9p..zk9KGouMyxuoj3OQQu6E6AGxIZSWhJzOpsXKWYnPkqMnX96gklsMe4mHxn+DdTxR+O7Nopy96jJNpoY76Thxj6mRmuU4xUr490Zoa+MJjfOApdsq7V1LK1MJBAK60OZF7wmX5vF1UEZcpFkM3xNAcaXmXtKuRixwtLWONcWwYTNfaFkieF.T5PB4pQbyeO1VJjdCjBlU1BvQT3MS86S8yl6S7.AutBdSXJmG13HJmRxNa+kM1GlII9PchNm0ha9C9m380WXFmtX8dJ7sWrrhueikcjLTwD8aSflP3cMlGD51EfPrnPzEBJGbtoQA8piX5pZ5XLDgcDweAeRDVSSajHr1HgyKdY8E3kKvKmM7x5KvKeu.ur9B7xE3kKvKmO7xMVfWt.ub1vK23V.dYh6VfWNE7xMVfWt.u7Cd7x+KhgKwxW9Vq3ER59z6FwAN2hnem2Rls0z3ZWcCjKr08sVV4c0ULr97Z3FyqgOcdM7qmWCe17Z32LuF9s+yFpAE2JTIciGMQn1c1M5WFyvXWAA5xilHP+MjTnrn
-
@cadrose Hey Dave,
Thanks for your patients. This snippet has helped a lot! The one thing I still seem to be having an issue with is when I try to index to the panels array it breaks.HiseSnippet 2431.3oc6Z01aSrbEd2DVD1bCsftppenpctAtpNJAauqcHPobIu4DxkDhkctHnHj6lcGaOJq2Y0tylWJJp+U5Og9On8mR+CTI9T+Z5Y1Wm0wXVBo3VZhDhLm4smm4bly9bFnoK0.64QckjKr2INXI4uQo8I1r9q0WmXKs05Rx+BksrYX2t5FXj2QDlQejZ4pRqdhitmG1TRVd5M4iUtv0jB948OcUcKcaCbpIIoWRIF3sICHrTqMW94DKqMzMw6QFHL55KukA0dMpE0Gv0zJUkbzMNPuG9E57gMkhj70aXRXT21LcF1SRVYUp4Is6SOxNb7uj3Q12ByanJ0FVnPyaPsL4Hlac2CwtGRvGIZSZs9DKylwmIdRvF0L8DZ5vSnu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RAbK52CpyWdZbTMifFXKPYhkXHsGHyhCI3a9RdAN0A7uSKmp2Qev.8LmP2HbbfnfVTtHIE4VPGaSeN9DdisgFOiD0HrmWx2yPB8LRTi+L+XITYVLe1fXE8uZ2dmq.n15Gi1xFJRxmWZEJL9yCLYRNjX5qa4Uo8JupylsZpVqS6epYqNs2ci8T6rxcq2YwGV9H8CkV22whX.t0fx8NGI9ihj3OHRBiKFIZeoQh0dPmkzxCGpIxg4E4PsIsiX86p0Qao7PhmJRhGIRhmN4IQsN0dTdHwyEIQCQR77IOIfqDp4gDuVjDsEIwqmzWI1XwNOXw7vgGJxg5hb3gSZGwlvUhZ45d85hjXYQRr9jmD05Tu9HHwm9COnc0COb0COb0CO7k4gGzt5gG9p3gGzt5gGt5gGt5gGt5gG95+gGt94zE2PTW7uSTWbiKlt3VeN5h6r5JsZ85.cwcVATEmq5SZKRgcDovqlvTXUnLwbUq68DovuVjB2aBSg0T6nlqBrzDovBhT3QSXJrtVGsGjGJrsHE1PjBaOgoPCHPJWdg4Eov2KRg4mvTXSHPZT2E9RjecftgKsiQnPXdV1aDXAxuZGPxBJ6vaiR9+500UdT0xUkF.R86XXv+F98gONL5IoEOIEkbOmZWf4T+BLmEu.y4AWf4rzEXNObrygWk0J9L5fP8cfglMB+lnbijuINsz+F8zryuA
Im assuming its clashing with the first inline function? I'm not sure
Ive currently commented out the second inline function that is causing the issue. Any help is hugely appreciated.
-
@cadrose You should load your images into your panels within on init, not within the paint routine. The paint routine is continually fired every time the UI refreshes, on init only happens once, and the images only need to be loaded once.
Then you should refactor your code a little so you are using a single paint routine for all the panels - since they are all doing exactly the same thing there's no need to duplicate the code.