HISE Logo Forum
    • Categories
    • Register
    • Login

    ComboBox - Overwrite List

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 300 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DanHD
      DanH
      last edited by

      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!

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @DanH
        last edited by ustk

        @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...

        Can't help pressing F5 in the forum...

        DanHD 2 Replies Last reply Reply Quote 0
        • DanHD
          DanH @ustk
          last edited by

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • DanHD
            DanH @ustk
            last edited by

            @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);
            
            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @DanH
              last edited by

              @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

              HISE Development for hire.
              www.channelrobot.com

              DanHD 1 Reply Last reply Reply Quote 0
              • DanHD
                DanH @Lindon
                last edited by

                @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!

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                26

                Online

                1.8k

                Users

                12.0k

                Topics

                104.4k

                Posts