Changing Selected Sample Maps With Buttons
-
@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.4D5TqYua2C84r97PdBfm08Z6Dg8eIdL4IX0zVyywciCBnRtXnDKIwNtWoGO37gS3uhYl+ynwzWDRTM53LDTjo6GwCCTHV0qS+IzvfAY1criiq2fbVXcCK7wdGQCny5OmM9.8.nbIr4C20VD75XCu1KO7bsf2ULv6C8F5KnQx7QTX6O4cHCbTivfKvFVl45r1mWyqOGlAS1ZJ9kjGIfFyjnw8Z2dGzca2t4daUaqZfiHVhNCKPOiRdUDWH2GceTl3iIx97oQbFznQ8YyntR1bIGhmFEBAN2GoCoTRk1Ui5o+njD8AdaLWbdOIKFD64UudC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N0futs5q6n9ZWGbHcLap1X1vKjLR5LBnhgzezhha20wxlu56NnvxXeY2BFKgggnd0k+dLAKXp6UIvAT9WK3IQ1N0hrfy2uzPHM5ZNP3mdb2KaHjFlNO.7sW5.HKVedHf7qDB1btH35d4YsrgwdVv3e+CcowGwUgdXAzs6ZUfpXrpvGSbspsYux5deYocINGT.Y0V.xxyjXgre9eXgr+4pfrxaR61MCqeUEX8huEwG3cDOHIDKK9LIp2FJc.HsSg2iP8lCrXp7baG1kxamrrv8Cg8+R+IUi20p.uvIuW13M8kn1x6fQiH9xbvdEuG82u7e1Ian7YmjkrPJH3oT13zKMnwyldYs9U3sAiV52FDhf0WSnvA9+b2dI.cIJ16+pqdo1eJOgUXsRA9wjHBVBdeKYtV2iOVepRYo9kGniUNQ.02ALg8.OkQ.ZWZai8E733Qf4n0Ur8PCRDiUbUdOGSNiHhK12SRlBtdFiDFmkV7ahIJWM0+HrTPKjeVuJsOAqc2q4YZ2oT6aWp8cJ0d2Rsuao12qT6uHu8rKPpBLTOXaohIu5xULInfAXvjslYO53YJ2zSd7a6bZVCEqWDth2Sci+P+bu+1cB65KGbeGuH8lYXbHU4cNfcFrsD5QgwOBp8bDNITl0amBn7HNiGMgyn9E2D.A0iGSD1XuRCZeoD1Cl2yG28XRHAGasK9y69X3lkXQw81uWbQmkmKVj+5S8LvEoNWC8+FYFW++6yLtHp6Fo4EQvpC2q5O194q6oOJGox796ETOlmHgLpYY07fTeCgz89D6DfqoRpZZ2N65vCIr.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.QBGE19X68nBLuCRFBRCKirfU9sqYuMSJAUrdezKw6xkDizv4A0pca38qUqx2sVo0JswFv8YHOS3uCwGGBITACFvX9vpK0u0J0j1kPwq6KAf196pruDorVRq6n.3FaT8B5S4LhbHxjyPA7LDObYaxQVZ7xu5vGB0ksq2EKzoJZJmxZ4fJAgQRVV4mR1nnx4GBiSATa.qe.iJIbJaXOlN+LkcZ8Iphl6XZnZeLQETLGSdUmlIJuhY4K9nsLRuImiFBai5GXR7gIogU0Uq7O7QZh5edH74kC0lsV80eE5rx2Nl7NYIuaVx6kk79YIefl7EWR0MlrHiyDFh8wtBBitDLHg5Kaa.6Lfps.jQ0lVkbwk8Mbiyrtsze6O.WYsRuYsRP42nJJcX1fzQsVyu1Z8P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zVQLqGy7BwF8Qtb1ItlKvpxkupdE4uaptmdQ6CTzvQWY11t150j8x8Hm35pb2UqC.4qycV.ct6Bny8V.ct+BnyCV.c95EPmuYp5nNLZyABVeSonbgVM0iPXYM57cqBf+FLJN3.G
-
@ulrik Thank You Ulrik
But The Viewport Max Value is Not 4 For My Project,
It's Greater Than 100 Or 50 In Other Sample map Lists. -
@Natan it was 4 in the example you provided, you just have to exchange it with the SampleMapList.length
ListWith100Maps.length etc...
-
@ulrik Thank Ulrik, Just Found An Issue With the Length Of Each Sample map names.
If I Select First Category And Select Sample Map Number. 100
And Then By Selecting Second Category That Has 50,
Console Shows An Error!
Because The Number 100 "Value" Is Not Exist In The Category That Holds 50 Samplemaps.
And It Points Me to This LineSampler.loadSampleMap(MapNamesArray[activeIndex][value]);