simple samplemap loading w folder categories via viewports



  • i see alot of weirdly complex custom samplemap loading with regex based on text string etc. but i simply want 2 viewports. one to select category (which is populated by the folder names with the Samples folder) and the second viewport containing the actual samplemaps locatated in the folder selected which obviously loads upon selection

    im using this to load a samplemap below. but i need a another viewport next to it that list the categories (subfolders) within the samplemaps folder

    const var s = Synth.getSampler("MySampler");
    const var list = Sampler.getSampleMapList();
    const var Viewport1 = Content.getComponent("Viewport1");
    Viewport1.set("useList", true);
    Viewport1.set("items", list.join("\n"));
    
    inline function loadSampleFromViewport(component, value)
    {
        s.loadSampleMap(list[value]);
    }
    
    Viewport1.setControlCallback(loadSampleFromViewport);
    


  • @mwplugs You dont need to put the samplemaps in a folder structure, you can simply have them in category arrays and show these in your viewports, theres even an example I posted at some point - try searching the forum.



  • @Lindon thanks i did see something involving BD SD etc. But christopher brought up that can be used from subfolders very easily the same as userpresets. im just wondering what the code is to have a function two panel viewport for loading samplemaps. ive browsed every post in the forum about viewports and samplemap loading



  • @mwplugs then you will have seen the example I posted. this is the only way I know how to do this - using scripting (and its pretty simple too)- you cant "reuse" the preset browser as far as I am aware.



  • @Lindon im trying to simplify it now by simply making manual viewport "categories" and then trying to figure out how to make that only show the samplemaps in a certain directory ex. a subfolder. any ideas?



  • @mwplugs obv left viewport is cats and right would be samplemaps in the specified directory per cat folder when clicked



  • @mwplugs you already have an even simpler(better more flexible) script based approach pointed out by @christoph in this thread:

    https://forum.hise.audio/topic/1146/viewport/25



  • @Lindon yes but it just creates an object. i dont know how to split up the data into 2 seperate lists and them make them usable by the viewports. im on hour 20 of this..trying over an over every possible solution nothing works.

    i cant take this and put into a viewport

    {
    "Brass": [
    "FreshHornStaccato"
    ],
    "Guitar": [
    "AcousticCampfire"
    ],
    "Keys": [
    "DeepFuzzVibe",
    "HorrorPianoFuzz"
    ],
    "Piano": [
    "CloudyJazzPno",
    "GoldenPiano",
    "RustyPiano"
    ],
    "Strings": [
    "ChamberTremelo",
    "ChamberViolinPizz",
    "ChamberViolinSpiccati",
    "ChamberViolinTremble",
    "MidMedSoloString",
    "MovieStringStacc",
    "SoloViolinLeg",
    "ViolinPizz1",
    "ViolinStaccato",
    "ViolinStaccatoB"
    ],
    "Vox": [
    "WhooMaleVox"
    ]
    }

    matter of fact ive yet to be able to put anything in a viewport other than the standard list from samplemaps..it always returns and error about "join"



  • @mwplugs first look up (javascript) how to access object elements, then look up (here) how to load a list into a viewport.



  • @Lindon i just need to know how to do it. its a very simple thing but like most things here there is no set documentation. so how i have gotten this first is reverse engineering implementations. i know nothing about java. ive made alot of great things with hise. however certain things simply arent documented and i get stuck 100 hours on something someone can simply say heres 2 lines of code. from that point i understand what is going on by seeing the code and understanding what is happening.



  • im thankful for all the help ive gotten over the years here. im not a coder. im a producer that is good at sound design and gui's and marketing with a large customer base. i do things myself because i want to learn. but i dont see myself ever fully grasping java or c++ my brain is already stuffed. if there is solutions in the forum for things i cant figure out, i implement them and then reverse engineer why they work. maybe one day i wont need to ask a question in the forum everytime i try to do something. im just used to having definitive documentation and answers available at my disposal.



  • @mwplugs the definative documentation is available:

    https://www.w3schools.com/js/js_objects.asp


Log in to reply
 

12
Online

884
Users

3.2k
Topics

26.8k
Posts