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2MiqKZCmN7hfOu8y2vRkJ2VV48eKndHKT.UTSppYAk95Bk6cv5E.mSVTMZb8jGx0EScUC9S3m3EajTsTtXijEMbRTEXaw+u5MflyG0TrpgOOnNrmdHc.zTgDRPEsOInbHxgydgSz6ZkX85pY.TRieq29xw1MF8fVq50paLDpU8BGG4EguCX3hk4dyfL2eFjYsYPlGLCx7vYPlGMCx78STFYaBaFJXCiRRBSzY6n.KysGEXMuweADmpd8L
-
@ulrik That's Why Your A Legend ️️️️️
-
@Natan I think it is important that you understand what is changed in the code, and why, so you can benefit from the understanding in your next project :)
-
@ulrik said in Changing Selected Sample Maps With Buttons:
you understand what is changed in the code, and why, so you can benefit from the understanding in your next proj
Sure, I Always Do My Changes By Reading And Learning From Expert Codes.
:folded_hands: A Ton -
@ulrik
Can We Have A Prev Next Button For It :folded_hands: -
@Natan absolutely, you know how to do that right?
-
@ulrik Yeah :) I Have Time & Examples Thank You So Much
-
@ulrik
Is This Good?/// Perv Next Buttons const var PrevSample = Content.getComponent("PrevSample"); const var NextSample = Content.getComponent("NextSample"); /// Pervius Sample inline function onPrevSampleControl(component, value) { if(value) { ViewportA.setValue(ViewportA.getValue() == 0 ? MapNamesArray.length-1 : ViewportA.getValue() - 1); } }; Content.getComponent("PrevSample").setControlCallback(onPrevSampleControl); /// Next Sample inline function onNextSampleControl(component, value) { if(value) { ViewportA.setValue((ViewportA.getValue() + 1) % MapNamesArray.length); } }; Content.getComponent("NextSample").setControlCallback(onNextSampleControl);
HiseSnippet 1967.3oc4X8uaabiDdW6rNw5hCZKZA5+T.Bgd.RvNJRINoGN2zHKEmBiKNQvxM3vkZzxrKkDaVQtfKWm3FDf9nbOB2iPeTtGg9Fb2Pxc0xc8JEEg51h6jAjE+wL7a9lgbFxABtOINlKbb27jyiHNtW2a34L4j9SvTlygOzw8FdGgikDAxzUuyivwwj.GW20+ZUGtadEG8me4A8vgXlOIuKGmmwo9jGSmRk48Nn6eiFF9Hb.4D5TqYua2C84r97PdBfm08Z6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07fTeCgz89D6DfqoRpZZ2N65vCIr.ci+C7IcvNYYKUC1IaPG+LUA1V5u02j1ccSox5B9Bg7vg1gzwPQEJHAYz9MAkSw9B924adc.EVultG.krzaLejpMpyrmEvqcq1NSgbUemuuZivMAFtZYt8JHycVAY1cEj4tqfL2aEj4KVAY9KKTFUYB6mH4SMGRBcL3.Sfk6AyBrV24+ZunVRI
-
@Natan No It's Not
-
Prev Fixed, But Next Has Issues :) LOL Both Wont Load SampleMaps : )
/// Perv Next Buttons const var PrevSample = Content.getComponent("PrevSample"); const var NextSample = Content.getComponent("NextSample"); /// Pervius Sample inline function onPrevSampleControl(component, value) { if(value) { ViewportA.setValue(ViewportA.getValue() == 0 ? MapNamesArray[value]-1 : ViewportA.getValue() - 1); } }; Content.getComponent("PrevSample").setControlCallback(onPrevSampleControl); /// Next Sample inline function onNextSampleControl(component, value) { if(value) { ViewportA.setValue((ViewportA.getValue() + 1) % MapNamesArray[value]); // This Not Works } }; Content.getComponent("NextSample").setControlCallback(onNextSampleControl);
-
Prev Fixed :) Go Boy Gooooo
inline function onPrevSampleControl(component, value) { local activeIndex; for (cat in CategoryBtns) { cat.getValue() ? activeIndex = CategoryBtns.indexOf(cat) : ""; } if(value) { ViewportA.setValue(ViewportA.getValue() == 0 ? Sampler.loadSampleMap(MapNamesArray[activeIndex][value]-1) : ViewportA.getValue() - 1); ViewportA.changed(); } }; Content.getComponent("PrevSample").setControlCallback(onPrevSampleControl);
-
@Natan maybe
ViewportA.changed();
-
@MikeB Thanks Mike, Yeah I Just Added That:)
-
@Natan Over thousands of miles the same thought :-)
-
@MikeB Exactly :) Thanks A Ton
-
There is A Small Glitch Once It Reaches To The Max List Item For Next, And Viceversa For Prev.
Wont Loop Inside The Viewport ://// Perv Next Buttons const var PrevSample = Content.getComponent("PrevSample"); const var NextSample = Content.getComponent("NextSample"); /// Pervius Sample inline function onPrevSampleControl(component, value) { local activeIndex; for (cat in CategoryBtns) { cat.getValue() ? activeIndex = CategoryBtns.indexOf(cat) : ""; } if(value) { ViewportA.setValue(ViewportA.getValue() == 0 ? Sampler.loadSampleMap(MapNamesArray[activeIndex][value]-1) : ViewportA.getValue() - 1); ViewportA.changed(); } }; Content.getComponent("PrevSample").setControlCallback(onPrevSampleControl); /// Next Sample inline function onNextSampleControl(component, value) { local activeIndex; for (cat in CategoryBtns) { cat.getValue() ? activeIndex = CategoryBtns.indexOf(cat) : ""; } if(value) { ViewportA.getValue() == Sampler.loadSampleMap(MapNamesArray[activeIndex][value]) ? ViewportA.setValue(1): ViewportA.setValue(ViewportA.getValue() + 1); ViewportA.changed(); } }; Content.getComponent("NextSample").setControlCallback(onNextSampleControl);
-
This post is deleted! -
inline function onPrevSampleControl(component, value) { if(value) { // get current value from ViewportA local currentValue = ViewportA.getValue(); currentValue < 1 ? ViewportA.setValue(4) : ViewportA.setValue(current - 1); ViewportA.changed(); } };
-
@ulrik so prev button count down to 1, if < 1 it starts at the largest value (4)
Now you need to go the other way, if next button > ? then... -
Maybe this will help you?
HiseSnippet 1529.3oc4XstaaaCElJNpq1qYncq+X+ZfvXCPFsNwt21v15pyEmgrkzXDmVTfhhLFIZahJSJPQmVut.rGk9nrGo8FrwKRVRtxWpWcxvl.BPN7bN774yMxCawYt3vPFGXU73gAXf00raOjJ5scODgB1aGf0WYW6NUeL90hps33ypdDh5w5C2bfGgsOiEzxGMDyAaML.EFh8.VVE9QkpVEWEn+9yGsExGQcwIKA.OkQbw6S5SDIq1pwOS782E4gOlzOkz2qwdtL51Le1.ILKXWCDfbeIpK9wHkXqXCrtRSOhfwaKPBbHvZ0sXdCa2i8JpQ9mRBIm5iUD0AskajY4cY9dJDqVErcOhuWqX2QH.XY2Jw4Tv3bto8ADOxn0SbRWWy.lnQZ+g0JSCd0SCuZyO7rRAuUMv6F1sc4j.QBGE19X68nBLuCRFBRCKirfU9sqYuMSJAUrdezKw6xkDizv4A0pca38qUqx2sVo0JswFv8YHOS3uCwGGBITACFvX9vpK0u0J0j1kPwq6KAf196pruDor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