Random Presets



  • I would like to have a button that randomly selects a preset.
    Math.randInt()" alone is not enough - it seems to be more complex.

    Are there any examples here?



  • @MikeB Lots of the preset browser functions don't seem to be available for scripting, which is a shame. I think there's lots of use cases, such as this one.

    Do you have a snippet?



  • @MikeB

    var  myPresetList = Engine.getUserPresetList();
    
    inline function onRandomPresetControl(component, value)
    {
        local myRandName = myPresetList[Math.randInt(0,myPresetList.length)];
        Engine.loadUserPreset(myRandName);       
    };
    Content.getComponent("RandomPreset").setControlCallback(onRandomPresetControl);
    


  • @Lindon
    I've already tried with arrays and giant loops. But this is elegant.
    Thank you very much Lindon.



  • @MikeB Dear Mike, Can You Confirm That It Works?



  • @Lindon Thank Lindon, Works Nicely

    HiseSnippet 1105.3ocsV0saaaCElzIpa1cNcEXO.B4JafTC4zzthFTrT6XuYrjTi3jtATTzwHQaSDIRCJpjZTTf9HrWk8Fr62U6MYWt6xNGQYK4FmhDCL4a74W9cN77C6qU973XklPKexzIbB8abFLUZF2dLSHI81mP2v4PVrgqcsrZMcBKNlGPnz09QjAs75jzu+4GZwBYRedNKB40JgO+.Qjvjys+d+rHLrKKfehHpf16rWOekrsJTk.3YMGOxDl+4rQ7iXnZkbHz60IPXT5AFlgGC5zRELcvX0kRq9uVDKNKjiDMIC.GYYSZOVDFzeVrFSHz06mG4qYi7uy4PQfXN+7Lv2lJvM2hh4.ZoEgz5K.ol2Dj5pBCPGbCviV.dqag2CcF3qESL4RPrcemdR3xYHCR6EgkUWRoSK4zVAZHMMhXmy6pAh4VT6odda49DOu56VsB96Bl10MZZeMOlaNPDabegaG4Hgj2XD2bZLWmKpFZDbeAJglcLSFnhrhAqlcnfYsUQSTRfn1lEUZyYGZ0JBYHbDtCSj9FgR5pjEUDckVEVyele1BNvvDd8pU9P0JtvWnxmEB3FsBqUfyuXP7lCYlwMzfPHxq4sUQYMB4xQlw0e6tVWIFValyQxrfOTwBxi9Z4mT8ccseUq7QvC2lntQdH0lEFdFThWaoAb8cKjPNRY3uRVqdkOTobkOVw8yEMb3Rkk4pPtdohw9O8WxvZxjny35YY7YJBEkKV0e+aWUuuM+TPQkrmTXd0DdFcdeAJyF0yj5QlGrEYkGiE4lFZKQsbVWusijc+A+6zd6yLLrSLiGn2Dt1HvnktO+BXrlsurry973yMpIvDp4W5PFwjMTw1I1EJgLB4nSDPVQ.A3CbJxpI48ymC9oeZuoyIb+s8tTDXFSnNz+lRHi4hQiMH0Nz430BjG3XKeZoUWB0pjyFMaTZ46Ad5eQ2IL7nbt+wU+9UKxcaj8e8mWkxNMCT5QTmz1rMwasArK3sRLFkbym6ZzI7slKpy6mvjwP0S7KiAmkDgpLjEFWPmzaW8M3.7pM95tEpyrFbcYcYWnz.3w0FKH7njHKDPa11xyx3Wvj4wPdWARdisI2qwi+rustyBP9uEFBf2IyqA9JaMvFY0.1vH81eCmhM73kuC8SPJeJ9mmA+IFRz8jYhg44bIC5mv8PGvYZIxRDenJBNGlFrhVhb8UFvhKUPRHyr31Lbscl.35Zg0F3pA3RzLs3Z86vJNukthq4x50tkv8gN8EF+wKGukVBdgd1+uwa1CFp5zY3PtuIGrq6z8WW0WGbGfxwpDbvArVSKvRGnbe.z75yAjHk7vXrJpDNOyR6gzXlY.WFjRbE7kIrIRSyD1blPRDyWqdmucnI9jjuNkCfIY5qwJCOKDncaRRWM.1430viDAUnuy2GSEOBv9xsY6UvlGuB1ryJXySVAad5JXy2uB17runM3vgWlXTQ11DfQ+NoivozNoSORqHI+GbYjTKB
    


  • @Natan here the complete Snippet from the preset selector with next/previous/random

    HiseSnippet 2472.3oc6Z0saaibElzxSRj1jrIAAs8hhEDt8BYfDaIY63jFjF4ejSU2XaAKkMaQQgyXpQRCL0LpjibVk.CrnnWz2gdy9HzK6k4Qn2zqytuA4MX6YFRJNThTVqS1MIcECBjm4L+7c9+LbXMWtMwyi6ZXlswfdDCyKipOfI5rUGLkYTcaCyqip4R7HBq5DGhs.F5lC5g87HMMLMy7H4vLyNug54MObSrClYSh5xv3K3TaxiocohndqU9yoNN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88NSnmzaZKQOreIJhKrd+GW3s2VQSiOtshFw2RakLgkyKQLAb78CWEfeKeFHt4xGRdTyMIOpLuy7ntQX7osGvvco1dJwjVS8v4OBDKUXxCCzT2mP1ciNPR0NfoynD1PHfCIqaWJ68.hCA6oEN6OUVl20Ugpw1h27vHhItQQjOP5bjLoXHQUYl1zhgGEQ08HPbSfeCnLJRdVqVK9p.Ziy0ADhuQeyi9teiFiuK9XR+dIrUiS38roZnMUhNzgDSzgdt.63DMUyDPLQS0KM7Zinc643GsVZrd0fNrj8TbDC13Qu2l3fiUKxSiUyHXElvsJUkcBwUTiCmWdzJYdmkLX9otbKIKY8QS4g2.oD4eLAXkIwGO.9ZnZ3OZqK3CovHYQMcGnZk9sNOKBxrHHyhf7y8SVjdDjmSDyhfLKBxrHHypAYh0fbVuUvRez9VAeeHMmp2zSoOXeSOm+rVZu00wyZonNUGedWrmf3teeQu9hYotlk5ZVpqYE+lZv1qN7JXnLh5C3VIG+Ep1VOEeBw5QDFIgKiIdzj+yz9Ab2ap+.t22V.aeCWLyqG2K1BWmzk1fyj5qnNehGYGWxeMgWYL1MQRu4g6.LYhyI5NZF8pkFON27SWbty3VFm+C5Oj7e5tt6LSGbOiafKaHF8yNVARZ4vgdBiB2B22QD1ab65c4LduNbF0VWoe.A7ja2l3pi8DYnQuqfaVdraG42V9wfgG1EjSjyor3czsQ9qP9v0R5LZ8+GelBY9Y4movnobPIlxYt2pTNefmVqK11kens+GVpzK3Rpd.IFS8QXlEJMFZaM7yQEgJrTAitPrzCsskJpaCR1jmSoywbV4bLmUOGyYsywbty4XNqeNlycm3bjow1nuf202IF5nVE+ueQygWTKbXw+GPiJwyN
    


  • @MikeB Very Nice, Thanks A Ton Dear Mike 🙂



  • @Natan
    is lovingly compiled from various snippets of the programming jedis lingering here 🙂



  • @MikeB Haha, I Just Finished My Project 🙂 And Started To Packaging.
    And After Finding Out This Feature,
    Deleted Everything, And Added the Random Button To The UI And Started The Compiling Again 🙂
    That Was The Last Time Gift For My Project 🙂

    This Week I'll Release It 🙌



  • @Natan That sounds good - I'm looking forward to your work. I hope you will present it here.



  • @MikeB Sure Will Send Copies To Our Top Hise Users.

    Also @Christoph-Hart Said That, There will Be A MADE BY HISE Page In Future, That He Will Mention About Top Plugins That Made By Hise, So Everyone Can See The Power Of Hise And The Result At One Glance👏🏻



  • @Natan Great thanks.
    I also wanted to suggest this page because it makes sense to see what you can do with HISE.


Log in to reply
 

7
Online

1.5k
Users

4.6k
Topics

42.1k
Posts