Help With SampleMap Selector



  • Hello everyone.

    Im using the code below to change SampleMaps using a ComboBox and it works as expected.
    I would like to know what I need to change to make this a vertical list i can choose from in a Viewport.

    ==================================================================

    const var ComboBox = Content.addComboBox("ComboBox", 0, 0);// [JSON ComboBox]
    Content.setPropertiesFromJSON("ComboBox", {
    "text": "Presets",
    "width": 189,
    "bgColour": 4278190080,
    "itemColour": 4278190080,
    "itemColour2": 4211081216,
    "pluginParameterName": "Presets",
    "items": ""
    });
    // [/JSON ComboBox]

    const var Sampler = Synth.getSampler("Sampler");
    const var sampleMapList = Sampler.getSampleMapList();
    ComboBox.set("items", sampleMapList.join("\n"));
    inline function onComboBoxControl(component, value)
    {
    Sampler.loadSampleMap(sampleMapList[value-1]);
    };

    ComboBox.setControlCallback(onComboBoxControl);

    =========================================

    Any help is appreciated, my Hise coding skills and understanding of it are very noob right now 😞


  • administrators

    Are you still using 1.0.0 (the JSOn boilerplate code suggest that)? If yes then you‘ll have a hard time using viewports as list since this came with 1.5.0 or something.



  • @christoph-hart

    No sir, I am using latest compiled master branch. This is just code I copied from a forum post.



  • Anyone ?


  • administrators

    Content.makeFrontInterface(600, 500);
    
    
    const var Viewport = Content.addViewport("Viewport", 0, 0);
    
    Content.setPropertiesFromJSON("Viewport", {
    "text": "Presets",
    "width": 189,
    "height": 300,
    
    "useList": true,
    "pluginParameterName": "Presets",
    "items": ""
    });
    // [/JSON ComboBox]
    
    const var Sampler = Synth.getSampler("Sampler");
    const var sampleMapList = Sampler.getSampleMapList();
    Viewport.set("items", sampleMapList.join("\n"));
    
    inline function onViewportControl(component, value)
    {
        Sampler.loadSampleMap(sampleMapList[value]);	
    };
    
    Viewport.setControlCallback(onViewportControl);
    

    The main difference is to set the useList property to true to transform the viewport to a selectable list. Also note that the index is zero based, so you don't need to subtract 1 in the callback (please don't ask why).



  • @christoph-hart Thank you very much !



  • Is there a way to recall the knob settings along with the SampleMap ?

    For instance I have a simple reverb unit, but may have different amount for each SampleMap, when selecting SampleMap using the above code none of the knob settings recall.

    I feel like I am missing or not understanding something.
    Hopefully someone can help, or help me understand.



  • @dalart You can use the user preset system



  • @d-healey Thank you for responding.

    Is there an example available that loads both the SampleMap & UserPreset at the same time ?



  • if you choose 1 samplemap + knob settings and saving it in a preset, this preset will recall all (samplemap + settings).

    As David said just use the preset system. Don't forget of course to set your viewport to "save in preset" = yes.

    😉



  • @staiff Thanks for responding. I'll have to try that out 🙂



  • @dalart It seems once I change the setting "save inPreset" to enabled on the Viewport it crashes Hise.
    Im starting with the CustomUserPreset example, adding a sampler, and changing the setting on the viewport then it crashes. 😞



  • Ok, I have downloaded and compiled the latest development branch, to use the newest method of the preset browser after finding out in another forum thread that new customization options had been added to the branch.

    Everything seems to work and appears to be exactly what I need, but I have a couple questions about hiding certain elements of the preset browser.

    Id like to hide the search bar element and the star element, I looked through the documentation and the API but was unable to locate the info.

    Any guidance would be appreciated tremendously.



  • @dalart Can't be done yet as far as I can see.



  • @staiff said in Help With SampleMap Selector:

    if you choose 1 samplemap + knob settings and saving it in a preset, this preset will recall all (samplemap + settings).

    As David said just use the preset system. Don't forget of course to set your viewport to "save in preset" = yes.

    😉

    Im not seeing the saveInPreset property when using the floating tile PresetBrowser 😞



  • save in preset
    samplemap is saved inside the preset !
    text alternatif



  • @staiff Thanks, I managed to get it working !

    I have a question about customizing the the default PresetBrowser that's in the floating tile properties:

    I would like to customize it to look like this:
    0_1541016215776_display.jpg

    If none of this can be achieved using the default PresetBrowser, is there a way to build one to fit these needs ?



  • @dalart That can't be done with the default browser. You can create your own using panels and the load preset function but last time I checked the save function didn't work (might do now though).



  • @d-healey Thanks for responding 🙂

    Im probably stuck with this until more customization options are added, I cant code at all, Im usually trying to edit snippets I find on the forum, but I truly dont understand the code.



  • @dalart said in Help With SampleMap Selector:

    @staiff Thanks, I managed to get it working !

    I have a question about customizing the the default PresetBrowser that's in the floating tile properties:

    I would like to customize it to look like this:
    0_1541016215776_display.jpg

    If none of this can be achieved using the default PresetBrowser, is there a way to build one to fit these needs ?

    @christoph-hart is there any way to hide/change these elements ?


Log in to reply
 

2
Online

339
Users

1.0k
Topics

7.1k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.