Changing Selected Sample Maps With Buttons
-
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... -
Mayb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4mvlxIbocQE8k3MYAvK9z.k0Wnzfh4lC78vwCcyQNvslYNfJY5eRNf4xL4mCjxCbQmCjNNvD3CoNUJ8lREKcdI33r5zIWdQ.2GyyksZjM9zTzgNn+oXdb.OVP4rKYGNxdxCGkd1MWi2OkfL5dTh3v.LcRiLAhBYxgmVMBURQE5Qm9jnQmLkG.hbBoqZaN+.nQb5oWASR619D4k.0Z+Q15rmwU9pM.ygouhsJW48vvYzU0qIGcexd6fDH0jiQ9AouI.yEDka2ZG7YxQxMyQVzdGb3KEr.siJJ2VFZlsq50ir3e7rFCSH3MHgGv5K2FDeXb7IYmuxLciSXia7rFgBbPaxuhS+hCx9AIj2rAXt9QD4zSz72eRJK8V+o+SvdVAjj88srT66uj299ti1ec6CXdC7Qhru5f5oVhXHq1xLduZDdZHQLLsiYo7TDyKbugcKhvsW93ckbvqLWcYi2nG1YM6lc5Hm.IArqZu6yV9uhSZn7YwPYzv8XyC3bS62cTiODO3Vvb+faxIgbkgsL0X5X4wb4QaDZ2zlRAylTjzW3kd4iXLg5.lzO3mYlJoGkKjaeFowmg4gY2A0fUl276KrGe7pzC7B5qbG1VJczcBL+quDWZSkdglTuXRqByc.983UDW8e0uh3EWmlByGbmwCcVLFisIp3cS5YXeYchFiep7TqNnA9h3UyVjb.ixB5wnD2r4YBNoaWLOM1y8GzlBgLWO8wJGg8wnvTIzeYi8kW5EwGuT48vWTe98ESKd841F3BUU1v+abBQg+edBwQrABYG1CPxDUUurGOneaYiYWrDITJ1WcmYqUT2MzPWKteVaL0SS7WxuHl0UzVQLqGy7BwF8Qtb1ItlKvpxkupdE4uaptmdQ6CTzvQWY11t150j8x8Hm35pb2UqC.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]);
-
@ulrik said in Changing Selected Sample Maps With Buttons:
ListWith100Maps.length etc...
That 4 Was An Example :)
One Has 105
Second HAs 45
And Last 2 50 Maps. -
Okey I Removed Viewport.changed(); On "CategoryBtnsControl" Callback,
And Now it Makes More Sense. And Error is Gone.With That Scenario, Once You Click On Any Of The Category BTN's,
A New Sample map Gets Loaded, And It Is Not Good, Let Say End User Just Wants To Take A Look At The Maps, And Don't Want to Pick A New Sample Map, With That Idea, He/she Easily Loses His/Her Preset.Okey Back At It :)
Just Prev Next And We Are Good To -
@Natan I made this
HiseSnippet 2070.3oc4Y8laabiEeFaOIwJwAsEcA1ur.DBEKjfcUkRbRKpSZjkhSgwZmHX4FrXSM5ROCkFVOhb.GNNwMn.8HrGg8HrGgdT1iPuA69HmYzvY7HYEg51hV8AYQx26weu+wGezCDbWRTDWXYu9wWDRrruiyvKXR+99XJyZ+mZYeWmCwQRh.kLUuKBwQQDOKa6U+R0D1qulk9yO8jd3.LykjOkk0K4TWxAzITY9rC592nAAOC6QNlNwf5s6tuKm0mGviA7rpSaqPr6Y3wjmiUjshik8M1yiJ4hgRrjDYYuVOt2EC84ulkP+KoQzSCHpAcrFBBJY5mwC7THVMqUeeZf2fL8Nxxx1YPtUX0DqvG5bH0iNc9bqw6oW.kygo8vdk4AuNlvq8hCOaC3sVB7demgtBZnLeEE1tsy9LvQMBCt.SXkPq0J+qa6zmCTvjslfOi7LALXJGMdX61agdP61M2YiZaTCbDQRz4XA5kTxqC4B4tnGixXeLQ1mOIjyfAMpOkh5Jdy4bHdRX.D37XjNjRwU5TMpm9iRbzGrai4hK5IYQ.aup58a.Ey3Q0at0F0Py7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ILwf8RBrr2aZf0pV+eP6yAeT
-
@ulrik this will check the length of current samplemaplist, and act after that
-
@ulrik Wonderful :) Appreciate Your Help Ulrik, Your The Best
-
@ulrik Is This Correct Way To Use A Knob Instead Of 4 Buttons, To Change The Categories?
Am I Missing Anything?HiseSnippet 1921.3oc4X8taabiDeW6ro0pwAsE8.tub.DBEERvttRINoGNkzHKEmBiFmHX4l6v0ynfdWJI1rhbAIWm3KH.8QoesneouAsOJ8QnuAsCI2UKWkUJJFM8J5seXkH4LC+M+gCmYGH3gDojK77233ySHd9WIX34L0j9SvTl2A20y+pAGhkJh.Ymp24IXojD446u9mpmveiK4Yd946zCGiYgjho77dDmFRtOcJUUL6fteFMN9d3HxwzoNTua2CB4r97XdJfm0CZ4kfCeLdL4AXMYqE34e48inJtXnBqHRO+K0iGc9vI7mvrz+HpjdZLQOns2PPP1ouGONRiX8rd8mPiiFjq2ROO+fAEVg0sVg2K3PZDc17EVi21r.pfCW6g+ZKCdscgWqUGd9Nv6RV38NACCEzDUwJZr8VAGv.G0HL3BbgkkVu09tMB5yAJXpclheL4dBXvLNZbyVs1FciVsZ1YyZaVCbDRE5Lr.8HJ4IIbgZOzsQ4rOln5ymlvYvfF0mQQcMuEbNDOMIFBbtMxDRo4JapF0y9Sc6tsYMzBebk3mw3m1dg3vrZ84w+.Jlwsa2g3DoNVRBh3KNoiV5ezGgPCXtz2eBmJVJ88mTR93H4BI2J+HW56QhikKU98hs1jQbApAEVqUGDEcKztvOasUyMq8Lq8pJMamjT4jF0GvP02BkfERB3gaP2p8NsZpsLZ9pRCy3q+DTczBYrBUMe+hVFeUoxYL1KtZFq87xdQfOCa6ID3y0lqpT9sqT01tH5pBEX6JQ2IcJXpjyVPN6Ajmp5oXFmV0AhZprBrdysWVrc0rq2fb1OoiyoikeL40wZTVLkQPiRYgJJmg3LygLMtE73Fg4fdav5DmRJhM0OyxKrij.pEUQlJqucYW4WX36jc9JNk0n9+gUG78vgfimPk2YyZOGz9kdVWK4LvzGGGe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