ComboBox - Overwrite List



  • I'm using a combobox to save my samplemaps within my presets. I've now linked it to a function that allows users to change the sample map within a preset. So far so good.

    My problem now is my labelling of the samplemaps.... At the moment they go AAA101_randomname, AAA102_randomname... and so on. Not the nicest to look at for the user! Is there a way of inputting a new list into the combobox that overwrites the samplemap names yet loads the right sample map?

    At the moment the 'items' list in the property editor is 'overwritten by script' (obviously).

    Thanks!



  • @DanH

      1. If the names of the sample maps contain the right name, you can extract them (in other words, remove the characters you don't need)
      1. You can create an array containing all the names and refer to it, assuming they are in the right order regarding the sample maps order...

    I'd prefer solution 1 😉

    Note that in any case, you'll then need to load sample maps from their real names, not from the combobox item name, since it won't be the same anymore...



  • This post is deleted!


  • @ustk Thank you!

    I think it will have to be option 2 for me I'm afraid haha! How would I go about referring to the array?

    My code for thr samplemaps combobox is:

    const var Sampler1 = Synth.getChildSynth("Sampler1")
    const var sampleMaps = Sampler.getSampleMapList();
    const var COMBOBOX = Content.getComponent("COMBOBOX");
    COMBOBOX.set("items", sampleMaps.join("\n"));
    
    
    inline function onCOMBOBOXControl(component, value)
    {
      Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]);
      Left_Random_Value.setValue(randomValues[1]);
    };
    
    Content.getComponent("COMBOBOX").setControlCallback(onCOMBOBOXControl);
    


  • @DanH said in ComboBox - Overwrite List:

    COMBOBOX.set("items", sampleMaps.join("\n"));

    nearly there...

    const var Sampler1 = Synth.getChildSynth("Sampler1")
    const var sampleMaps = Sampler.getSampleMapList();
    const var mySampleMapNames = ["hello", "world","the","names","you", "want", "the" "user", "to", "see", "go", "here"];
    const var COMBOBOX = Content.getComponent("COMBOBOX");
    COMBOBOX.set("items", mySampleMapNames.join("\n"));
    
    
    inline function onCOMBOBOXControl(component, value)
    {
      Sampler1.asSampler().loadSampleMap(sampleMaps[value-1]);
      Left_Random_Value.setValue(randomValues[1]);  //<- I have no idea what this is doing...
    };
    Content.getComponent("COMBOBOX").setControlCallback(onCOMBOBOXControl);
    

    Just make sure mySampleMapNames contains ordered and paired names with your actual sample map list



  • @Lindon It's so simple sometimes ☺

    Thank you. And that randomValues thing is something I'm playing with from this thread:

    https://forum.hise.audio/topic/3530/prev-next-buttons-for-each-combobox/12

    Cheers!


Log in to reply
 

15
Online

1.2k
Users

3.8k
Topics

33.6k
Posts