Changing Selected Sample Maps With Buttons



  • Hey Music Lovers, And HELLO @d-healey Lol

    An Idea Crossed On My Mind, and I Need A Little Help Here.

    Let Says, I Have 4 Samplers.
    Each One Has Viewport On GUI That Let The End User Select And Layer The Maps.

    Wondering Is This Possible To Have A Set Of Buttons, That Let the End User Choose What Sampler Play What SampleMaps.

    For Example:
    Piano | Pad | Strings | Base Buttons

    I Think I Need 4 Arrays That Keeps The Sample maps Names.
    And A Set Of If Else To Change The Viewport Showing Names, Correct?

    And Is This Idea Work At All?

    Thanks



  • @Natan said in Changing Selected Sample Maps With Buttons:

    I Think I Need 4 Arrays That Keeps The Sample maps Names.

    If all the arrays are going to have the same sample map names then you only need 1.

    And Is This Idea Work At All?

    I don't see why not.



  • Thank You Sir
    @d-healey said in Changing Selected Sample Maps With Buttons:

    If all the arrays are going to have the same sample map names then you only need 1.

    Exactly, But What About Having 4 Categories?
    Like: PianoNames | PadNames | BassNames | PadNames
    So End User Can Even Go Crazy But Adding 4 Bass, 4 Piano, Or 2X2 Of Maps.



  • @Natan said in Changing Selected Sample Maps With Buttons:

    Exactly, But About Having 4 Categories

    So you will have 4 lists of sample maps?



  • @d-healey Great, Let Me Waste All My Day On This Idea 🙂 And See What I Can Come Up With 🙂
    Thanks A Ton @d-healey



  • Okey First Problem @d-healey

    Can't Change The Viewport Items:

    Viewport.set("items",SampleMapsNames[value]);
    


  • @Natan said in Changing Selected Sample Maps With Buttons:

    Okey First Problem @d-healey

    Can't Change The Viewport Items:

    Viewport.set("items",SampleMapsNames[value]);
    

    @Natan Fixed 🙂

    Viewport.set("items",SampleMapsNames.join("\n"));
    


  • @Natan go look at the view port (Ctrl-J) and you will see the format that "items" needs to be in....

    [
    {
    "type": "ScriptedViewport",
    "id": "Viewport1",
    "x": 340.0,
    "y": 16.0,
    "parentComponent": "HeadderPanel",
    "items": "item 1\nitem 2\nitem 3"
    }
    ]



  • @Lindon Thanks Lindon
    I'm Going To Change The Items Using Buttons

    Viewport.set("items",SampleMapsNames.join("\n"));
    


  • @d-healey
    Sir, Do You Have A Shorten Way Script This?

    HiseSnippet 1782.3oc4X01aSbDD9tjbAhgf.DeneAoSV8CNRgH6j.TITDN1IAEQBXEGhpTAQWtas81b2tmtau.onTwOo9Sn+j3eP6r6dumyNWdihZMBk8sYtm8Ylclc1d9LKbP.yWSet8O1Cqoeai9GS4i5NBQnZaugl9cL1EEvw9lpg5brGJH.aqoqO8KDCnO2LZxee84cPNHpENcHMsCXDK7NDWBOczdseIwwYKjMdehalUuZ6ssXztLGVHfmoMZp4grNDMD+JjXYSYnoO6l1DNyuOGwwAZ5yzgYeb+QrORUq+.R.4CNXQmVZ8AEoFdKlis.whQ05Nh3X2KdeGnooazKkElVwBOvXWhMIY7T13txILSkHKenO0jfWqrvqY0gmdF3MiBd2ynukOwimNi.a2xXaJXnFf.SPVXoVq1T+wsL5xfUP4K4hNDukOzIQhFOoYyEMebylK7r4qMeMvPDvMOB4ad.A+QOlOecy0LiEeHl2k45wnPmF0SVQcgroR1G454.NNqYJcoDREMTi5QMJHQOBhxBF6GRMcAY5NhQ7GuLpoK9cP1S3q.SVX8cvNNiW.4r0U7VdtSBX0VcWjWfvOVnleY9Z06QMejYq5KpZrbbiUharZ8EeWAKgbqTt15NJRaxFKG2Xk3FknMw1bLPyNFZ1wPyNFZ1kqLIETt153DoMYikiarRbiDsI9Gg5PnXyAgTKNgQMcXHakZAuU2DGsFVwr+hvm2IDuv709770LMMICZn7RD1nCDS0XAy0Vyr0Bxok+9bZyH2vkR+N.7aTlY6Wjem2IrxwBCdCALG7Rd9DvMXhBYZlH0IoJP1B6DfEvV4ndYfcY9GIHXLndhxTATK7htTT8o8BOKHOIQxi3bHU5hdYfZY93mEVmnLYAaDyBfNwIeo.QTFJ2m4zE437AHWXiwbdHN1SwiOLp5vPjZtxN1jeSphKa1G6fs3VX65hsV5hysgZTmvwtA0WrriKK8aLBsQ82RquPFF8jxTk0HDcH1tgXmeB7+ImvnLpr.2jF9tLZTc3rJz344XbAZTJ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jxcOmUz3F4Feubiuetwqka7CxM9g4F+nzwi5XTFXH+BM4ZCZwoqMHPAcPfIqsyVj9iTdzL5wuinYETz9DPE7ATt1m0eemOcYXme5f6G3SPsTBF6RjdmsoW.WKgYjX71PWS8PgdhjYajAk6ynL+ALJwI6k.HnteeLWG6EZPaJDvcvzYtSyCwdXTf1s3us4dv60P7r2s+n3hFSOWLI+0WaEAWaYdM6+aTYb9+2WYbRT2MiqKZCmN7hfOu8y2vRkJ2VV48eKndHKT.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.
    🙏 A Ton



  • @ulrik
    Can We Have A Prev Next Button For It 🙏



  • @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+njD8AdaLWbdOIKFD64UudCnXFOtdyc1pFZtepVz9S3TwpI5.bvpIXORXHH4oZd01Z01ggHNBGEqhx0V8o6oT1stEBMfUfcTfegyu+jB5GP7bmtQ+A1yWCzEp+dgFaXDWfZPgwZuGhh9Rztv+1d6laU6MF5oJKqUTR7DfFYn5aihvhXBD60ftcmVsaphBzDXEVXpb8mfpilqfUXpYqWvhjqJSNUvdgUKXs2VzKBxoEaeg.ethtpx32oRSyJXpBCXmJQ2o6kKj8unrPJifFkv7kTNCAGjZsYREYJ3gM7yBK2AvdXBI2kQGgZj0kp8axUdH2GGhnr.xqUmAXo1V5Ne5nb81rR3M6DhVwDXGAURlFWemhT2y055zV+.mxZT+aY0aZqqbM3OAyFSBZ.dB0.u03OzQjuPx.XV.g4FHLnZ0SYh93vvW.YWZTIOk4kuHsFxwAFOBb74zYnZAD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E733Qf4n0Ur8PCRDiUbUdOGSNiHhK12SRlBtdFiDFmkV7ahIJWM0+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);
    

Log in to reply
 

9
Online

1.5k
Users

4.6k
Topics

42.1k
Posts