Unsolved Panel swaps with buttons
-
I am trying to make an fx chain replacement with Next & Previous buttons. The panel positions are saved in a Panel as an object. But array value changes are not working.
Please help. My goal is to link them to the Effect Slots.
HiseSnippet 1741.3oc2Y02SaaDF+Lf6pSoUsR6CfUz9ivfgrcLDdYrlxaqYq.YjN1jPrJi8Ex05XGYegRFCo9EXeW1mfo8Qp+49usmy9b74PRfZUTjHUEYeOu8644d9c2kb0C7swgg9AHIkW2qCFIMqbiddzVa0xh3gpsMR5gx0s7vtgnM60wJLD6fjjl96YRkTlAE84iOeSKWKOab5PHzQ9Da7qHsIzzQqW8GItt6Z4feMosf1lUqY66skuqeW.ISKqg5XY+Nqyv6awTaJYjzC1wgP8CZPsn3PjzLa56zqQK+26Eq+QjPxotX1K5nFfihGdWeWGFhYih1pEw0odRFGh.uTOM+mNN++R48HNj9imVGdZj.0TKDqGRSkEdSmAd5hvSS.dCARRBPZlXH8L4F1AjNzTIL77H4ZdTbPSKnrKBkXcQSMqh7V9fFdzEaa8N7tAvK8snjtll1BpFZZysdgBEfheHU0qa6Cgxdn5FpKsNerNr49eg3PaAipupVlweIlbVKJSfYeAVAA8dyNMahsoQ8MfziOIiv5A3y2j5ccA6iuflJfK4bq.0PVU8fSeKH4xnmW6X.75.9WPs7BplmbUF0YoMLqgC.8SJAmgoa42tiuG7Roh80nHj9DOW3Q0lc8roDeOUViHWL6g.e2R1Ilt.D.2t34JbYgBJJjlpknvTjeyTMXQ5HlNklaN0M1Psn+ouEpEEmCz+R3+JQUtCBbvAuzxywEGTBvfhxULGBzLbhdodLLwiI0gHCFoiTf+T.pH2XpybLOC2xx08TXtuz0S9nFD3SS+.0RDnjpstJQ8a62s.uM+7rBhJ7YvY+E6zMrUogiDA0JpNuJYNHRLej5Hdmx3bBWkLNPz1iImL7zTriKMSyFet3wEetJWO9bAeZwOJ7WEWuGrsbHS2PQGlrugIlntoAmW3vpTwKJtfHG+qSIOBMxKF03A1L25JQcWbGlsFWp34wqxAtjF.jj0GTuw3asStlO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DY2ZJW.APf3s1wtYNuPBsWFxwmqaU71BwmIWmPsaMbLN0PvHBcmfQ9cw9XdiRJ.mQd2e8t4hWQG52kR7NaOKZ.A5Gj2ua6F.O1FCQ2K5BvgVK1xq720RZ0Zf8bhd4+fObgredJIItP8Dgn1V1A9uwN9GEjcauOLZD.SdQWzsh7dr2U0S9o.kk0VTC0l3PdisMK8+FcDZ31XjCaJmCaLygMKkCaVNG1TIG1rxXsgcm+unK0ucLc.Fn9NQ+1qRR63w1rHpKD8+.mE+1w.
-
@Steve-Mohican
Here you go :)
const numRacks = 5; const panelWidth = 190; const panelHeight = 140; const arry_EffectPanel = []; const arry_PrevBtn = []; const arry_NextBtn = []; const var stateObj = {state:[0, 1, 2, 3, 4]}; const var Container = Content.getComponent("Container"); inline function onContainerControl(component, value) { if (typeof(component.getValue()) == "object") { panelOrderHandler(); } else { component.setValue(stateObj); panelOrderHandler(); } }; Content.getComponent("Container").setControlCallback(onContainerControl); for (i = 0; i < numRacks; i++) { arry_EffectPanel.push(Content.getComponent("EffectPanel" + i)); arry_PrevBtn.push(Content.getComponent("PrevBtn" + i)); arry_PrevBtn[i].setControlCallback(onarry_PrevBtnControl); arry_NextBtn.push(Content.getComponent("NextBtn" + i)); arry_NextBtn[i].setControlCallback(onarry_NextBtnControl); } inline function panelOrderHandler() { local panelVal = Container.getValue().state; for (i = 0; i < numRacks; i++) { arry_EffectPanel[panelVal[i]].set("x", panelWidth * i); arry_PrevBtn[i].set("visible", true); arry_NextBtn[i].set("visible", true); } arry_PrevBtn[panelVal[0]].set("visible", false); arry_NextBtn[panelVal[4]].set("visible", false); } inline function onarry_PrevBtnControl(component, value) { if (value) { local idx = arry_PrevBtn.indexOf(component); local containerVal = Container.getValue().state; local getPos = arry_EffectPanel[idx].get("x") / panelWidth; local swappedPanel = containerVal[getPos - 1]; containerVal[getPos] = swappedPanel; containerVal[getPos - 1] = idx; local Data = {state: containerVal}; Container.setValue(Data); Container.changed(); } } inline function onarry_NextBtnControl(component, value) { if (value) { local idx = arry_NextBtn.indexOf(component); local containerVal = Container.getValue().state; local getPos = arry_EffectPanel[idx].get("x") / panelWidth; local swappedPanel = containerVal[getPos + 1]; containerVal[getPos] = swappedPanel; containerVal[getPos + 1] = idx; local Data = {state: containerVal}; Container.setValue(Data); Container.changed(); } }
HiseSnippet 1717.3oc2ZssaaaCFlJIZnx8.ZA1CffwtvYIMSR1INodY0KmV8VShWcW1.BxJXjniYqrjgDcZ7xBPuZ2s2k8DLrGod4ta6mTRVTwNGpPyLVLPJD4+A98e3ih1rMC7sIgg9AHEsWNnGAobO0VC7XcVuCl5gZrAR4NpMwdD2PzZC5gCCINHEko+FtTEsYPhOu+oqgcwd1jzoPn87o1jmS6RYoy1r92Qcc2B6PdIsqj1Up2v12aceW+9.RlV0.0Ca+F7Qjcvb0lREo7Ia5PY9AsXXFIDoLyZ9NCZ0w+sdQ5uGMjdnKgOvD0BbTzza465vQLeVz5cntNMSh3PD3klow+zQw+mptM0gNb9z7vCEBzSsPNenLUV3McF3YJCOCI3MFHoHAoYhfziTaYGP6wRkvwycUa3wHAswPZWFJQ5hl52zTW2GzvisPW7aHaE.CFZQISCCi40sLLlsVgBPtOjo60u6Kfrdn9p5KVKdtd7R+ORcXcfYMWwHy7OiPOpCiKnxPA3ffAuZy1sI1LQaCHc+CxHrY.430XdiJXGxIrTAwRNFGnGxSp6d3qAImJd9I6CX2Df+75kmWuxAmkQcdTCEMR.neRF3HBac+t878fAkJNTihPzS8bgG0a22ylQ88z48gwh4OD36VxNwz4gEvsOY1BmVnflFssdIFTg7ampAek1iqSoYmUe0U0K5e3qgbQwYA8OE9SSj41MvgD7LrmiKInDfAMsy3NDXYjD8R8XXhGSxCBCtPGoA+SAHibkgN2wwQ35XW2CgZeoQCdd+A+Sa+.8RTHkZTSmp+kC6VfQyMGOgnCeNe0egd8C6TZ7HQRsh5yoSmEVItORcTbmxk4jXUx3.Ya2mdv3CSYkRizrqebC4ks9wpL55GK3xW+XkFt9hk+rn784aK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YBPYpjaJSkafNvBWMkoRtoLUtg9tXidAdOTcaem9tXV16SjeIpwBnPXIeId7KpyKjxFjoi8i0kLdcg3iTaRY1cFOFmZLXDgtQvX7Uyd+3pWJ.mQcqe5l4dXQuvuOi5cz1XV.E5vT2oe2V.4xl.qtm39vg5MeOu3wFI0+VDOGwf+A9DKj+aFonDKzLQHpK1Nv+U1Q+Rc7K+8NhY.L4It2aM0s4i0MS984TUMVv.0k5PeksMO7erIBMdarxgMkygMUxgMKlCaVJG1TMG1r7kZC++B.ecele2H5.LQyME+fnJJa5w2AWzEh9W.2zy31B
-
@orange Whoah! Thank you man, it's Awesome!!!
-
@orange this code is impressive! youre a beast
@Steve-Mohican did you ever find a way to link them to the Effect Slots?