How to use panels to switch between groups of samplers?
-
Im new to Hise and learning as I go, huge thanks to d-healey for the youtube videos!
I am trying to create a toggle switch that switches between 4 panels that have images displayed within them.
I would ideally have this switch between 4 containers that have multiple samplers within them. I would imagine by bypassing the containers in a similar way to how the panels are being displayed and hidden when clicked. Ive tried adding buttons within the panels that bypass the containers but it breaks.
any help would be hugely appreciated.
ThanksHiseSnippet 2544.3oc6b0sTajbEdFfgEo0r05MakJWjelB6sJQAVnYFAXBYWK.IvrFLpjXcryVaozLpkTWdzLploEXVWtxM4IHOA4QH2mKRdJx0ad.RU9pbK4z8LiTOBg7.FiV1LtJWlyo+666z8oOmSijK65Xh87bbkjSc3ocvRx2Qo5o1zVa0BQrk1snj7OWYWaJ1sAxDq5cBgZ1RUKaNoMOsCxyCWWRVdxcX8UN0TR7+71GsIxBYah6qRR5YNDS7dj1DZeskK7Dhk01n53CIsE5c9B6Z5XukikSW.WSpjSpCx7knl3mhXcaBEI4oKUmPcbqRQTrmj7Ta5T+zpsbNw1u+Oi3QNxByDzjpBSju5scrpyPLSqzVsHV0KGxeOII4Opbeqwj9ViOWYeRcRO88sJeJuA09iPzdHOQT3MYD3oIBubBvaHPRV.RS4Co6pT0zkzg1uEFd9396RQfheekl3eMsxVNPOroYaidIdaWPn2HxjOWtEUWMWt4WO8roAauGU8XjqZGjM1xS8KU+1ua8YgVZ33plg.xZqqRT+cpKC+yBKLu5qmMsJ7G+t+sjGn8cPeBWtlX5VNs63XCBYlqLqOys.Y90O2Xx5AVH1nbcrxz.Y4gA37F+tMaZFdL655ByBeNfU3AZbTQrsH1X0FcsMoDGaUG6M6RoN1ZgykY3xuHvJqt34mMc.hIMTyvUo9k.o5QjvlhrdeErdyGhWwVFJvUWZoGSpiU63hOl3z0yef8m9AnRzkZAFV9hf0JqE1tIsEaF224XrJ0Q0F+JpJwtN9U8mv2Ivntc8wE6fne24CFrvugaGG9FVfsbt4y5wzymqsPVVGAtjYFzTCaXoWZIeRraavi0aokRqBp3BpZfT+SW7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dn0+u+gV681nrSFrGdcpjGdM4gWG4CuZj7vqIO7ZxCul7vq2he30KexR4SRVJIYojjkRRV5xkrT9jjkRRVJIYojjktEmrzMAJuIVi1HSWmZl9eOyY1iY3Z.KgM+WZVJk8Yxp89BlOsxZ4xlSpMDPrloIya6AZLqX32a+5058sVVR9iYeqRG341EZ1++xdBDq4ufSyinAyuM6KH7CzxwWMzqXsXrB7yVNmHzRKRyV8Zx6kXnselhdV8kyqmeMCiUysbN8GZHw9dqx5FLDMIB+848OBlSBRvstis0oAGHGN80Couhx4Y+ELFiqvXxeEFyxWgwrxUXLqdEFyCG4XXYUsQWpSa+XJfhxk78CkK0yObRo+GfuLtJ4
-
@cadrose use midi muters instead of bypassing modules, this way you won't get audio dropouts when switching
-
@d-healey ahh yes this makes sense, thanks, would you be able to point me in the right direction as to how I could approach scripting the midi mutes to disengage when a panel is shown and reengage when the panel is hidden?
Thanks -
@cadrose Start with this tutorial for creating a tabbed interface - https://youtu.be/_s7LTRz8pEc
Then all you need to do is set the midi muters from the button callbacks.
-
@d-healey ahh yes Ive watched this video a few times now, very helpful!
one thing that Im struggling with is I'm trying to achieve this functionality with one invisible button over the panels. Should I be using inline functions with if, else statements to control the midi mutes? Ive tried a bunch of ways but had no luck -
@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.TEMBjQnrIU0Ucw9bxINemm8YVPSHs+D2+HSp+Gr8NamXaHjEhz1DsI+.j22e26du2mSJc7kVzf.oOxnzwm6QQF22r64B0flCHLAp0NHikMaSBTTebLqsO2iDDPsQFFEeolgQokPQed2K1lvIBKZJKD5DIyhtOykoR41ow2y378H1ziYtYz9oMZYIEMkbYHjOEMqh7HVmR5SOfnUqfIx3N6ZyTR+tJhhF.5rsz97tCj+pHV+SXArdbplnFpK3nX1nlCXb6NiNqAHjwG0I8jWL9j+Py1La1X9oUfOMR.N0hr0.iBSKkpcCRIiLozRwozCL6Z4y7ToRz4y8LaIfKDGBTpylJw5hJ7mELaJAMDp0bImR2yGHFaQkmUs5SvveVcyxkgxcfB6FBxZYGfeNN5tes9TUK68YApJqnO4s0xWAzOi5Zke8a.W3H8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E3kKvKmM7x5KvKeu.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+BksrYX2t5FXj2QDlQejZ4pRqdhitmG1TRVd5M4iUtv0jB948OcUcKcaCbpIIoWRIF3sICHrTqMW94DKqMzMw6QFHL55KukA0dMpE0Gv0zJUkbzMNPuG9E57gMkhj70aXRXT21LcF1SRVYUp4Is6SOxNb7uj3Q12ByanJ0FVnPyaPsL4Hlac2CwtGRvGIZSZs9DKylwmIdRvF0L8DZ5vSnuUYGhIIwd5I0OOnCT5LDOijmJKjmNCjUEgbUAHOBHIK.oqEBoaqz1vk3vR6gimal54x.kvwJM0cJnrFEFgMq7.8Cva3BMRlQo5Uqt.ZopUm6wEmoH3O7XnC0cQN51XKOzSPu4sOdFnmtTWTIBzV8wHB52iVD9q4meNz6loHB9Ib3ugbe02BiId65gYqQG3PsgFklsIeLyNOYtGet4T1CNg3yxkZUpqtkGFfyogCalhb7X365BqRvZ.6v8UgEgXaQrwnt91FLB0FQsW0mwn1pwqjQ7lu.vIKe7byTLBujtnRAlPOAnTBMh6Jyt8CvtMWLZE6YjvFUoxyHlXjiK9PB02KbhoK+PDI6VMOGKeezdU1Ba2i0muh6PODiXTjM9XFhXahONcA+n.i45GhKdXX3vClLb9dZfucztqnyxYm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t5gG95+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.