Switching question.
-
@ustk Great , testing that !
Would you suggest then using that index to switch the impulses as well or do that separately ?
I am getting slightly better at this but get confused pretty quick when I need to combine functions. -
@lalalandsynth Wait a minute, my snippet doesn't seem to work...
Yes you can set the reverb using this idx, but in this case I'd prefer to use another variable like:reg revIdx; inline function onButton1Control(component, value) { if (value){ revIdx = btns.indexOf(component); Panel1.repaint(); } }; for (b in btns) b.setControlCallback(onButton1Control); Panel1.setPaintRoutine(function(g) { // set filmstrip offset this.setImage("myFilmstrip", 0, revIdx * this.getHeight()); });
-
@ustk said in Switching question.:
UPDATE: buttons were in the wrong order..
What do you mean , in the interface or the script ?
-
@lalalandsynth in the script declaration...
I don't know what happened but I wasn't able to paint the panel so I restarted Hise and it works -
This whole scripting thing is such chinese to me sometimes ;)
-
ok, so this says it does not find the image in the project folder.
// MultiButtonSwitch const var btns = [Content.getComponent("Button6"), Content.getComponent("Button5"), Content.getComponent("Button4"), Content.getComponent("Button3"), Content.getComponent("Button2"), Content.getComponent("Button1")]; const var Panel1 = Content.getComponent("Panel1"); Panel1.loadImage("{PROJECT_FOLDER}/switchStrip.png", "myFilmstrip"); Panel1.setPaintRoutine(function(g) { // set filmstrip offset using this.data.idx this.setImage("myFilmstrip", 0, this.data.idx * this.getHeight()); }); inline function onButton1Control(component, value) { if (value){ Panel1.data.idx = btns.indexOf(component); Panel1.repaint(); } }; for (b in btns) b.setControlCallback(onButton1Control);
-
@lalalandsynth Ok, I was TOTALLY WRONG!
No need for a paint routine...
Here's something that works :)
It's normal for the image error, you need to place yours inside the folder and change its name...HiseSnippet 1082.3ocuW0saiSDEdbZ8xFujJVo8FtyJbSBJDbZSxhTEPo4mk.aahZJqVIzR0D6IIip8LV1S51nRj3ddV3Qh2AdCfy3wN1caTowBpuxme9ly2Y94LmYT.2lDFxCPZEOeoOAo8w5iWxDy6LGSYnAcQZ6oeBNTPBLUpNdoONLj3fzz14UREZE2EE88We6wXWLyljpBgdCmZSdM0iJR0N5nej551G6PNm5kw6lGMvly5v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Hg+F9hM1PJqEarQhQjG1Nfegsp.trc8mFoA3DK5UKEgmOAxloWwoaU2B4Auh3Baa4TwW.beyX1OGXNHGXZlCLsxAl14.yKyAlu5dwHe.22sPv8TGS.Ei5EcGplVuLkI9Gr9Q7qL
-
@ustk said in Switching question.:
It's normal for the image error, you need to place yours inside the folder and change its name...
you mean like this ?
// MultiButtonSwitch const var btns = [Content.getComponent("Button1"), Content.getComponent("Button2"), Content.getComponent("Button3"), Content.getComponent("Button4"), Content.getComponent("Button5"), Content.getComponent("Button6")]; const var Panel1 = Content.getComponent("Panel1"); Panel1.loadImage("{PROJECT_FOLDER}switchStrip.png", "switchStrip"); reg revIdx; inline function onbtnsControl(component, value) { if (value){ revIdx = btns.indexOf(component); Panel1.setImage("switchStrip", 0, revIdx * Panel1.getHeight()); } }; for (b in btns) b.setControlCallback(onbtnsControl);
-
@lalalandsynth Exactly ;)
-
Awesome , , thanks so much mate !!