HISE Logo Forum
    • Categories
    • Register
    • Login

    GetAllComponents

    Scheduled Pinned Locked Moved General Questions
    10 Posts 4 Posters 604 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.
    • LindonL
      Lindon
      last edited by

      IS there a way to get an array of all components in my interface?

      I'd like to be able to inspect them and change some colours programatically - so this would be a nice to have...

      HISE Development for hire.
      www.channelrobot.com

      1 Reply Last reply Reply Quote 2
      • d.healeyD
        d.healey
        last edited by d.healey

        That would be very handy. I propose to do it in two stages though, first get an idList of all components (similar to Synth.getIdList();) and then have another function to get an object containing all of the components in the ID list.

        This way you can filter the list with the usual string commands before grabbing the components. It also means that if you are just changing a parameter like the colour you don't need to actually store a reference to the component you could just do something like Content.getComponentName(idList[i]).set("colour", 0xFF00FF00);

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        1 Reply Last reply Reply Quote 1
        • Christoph HartC
          Christoph Hart
          last edited by

          Yes, it's an easy addition in fact it's so easy that David could do it himself :)

          But I would add a regex filter and directly return a list of references:

          // Empty string will return all components
          for(c in Content.getComponentList(""))
              c.set("saveInPreset", false);
          

          This will be faster than just returning a array of IDs which has to iterate over the entire list again to get the actual component in the for loop.

          d.healeyD 1 Reply Last reply Reply Quote 3
          • d.healeyD
            d.healey
            last edited by

            Bump bump :)

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 1
            • d.healeyD
              d.healey
              last edited by d.healey

              Could we also have functions to getAllEffects and getAllModulators?

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey
                last edited by d.healey

                Well I discovered the other day we already have getAllModulators and it's fantastically useful!

                My new requests

                getAllComponents();
                getAllEffects();

                getAllScriptProcessors();
                Or is this just as efficient?

                    const var processorIds = Synth.getIdList("Script Processor");
                    const var scriptProcessors = [];
                    for (id in processorIds)
                        scriptProcessors.push(Synth.getMidiProcessor(id));
                

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                ustkU 1 Reply Last reply Reply Quote 1
                • ustkU
                  ustk @d.healey
                  last edited by

                  @d-healey That'll be useful for sure! But why do you push everything in an array, is it not an array you get in the first place?

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

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @ustk
                    last edited by

                    @ustk getIdList just returns the names of all of the scripts, so I use that to get the actually scripts which are pushed to the array.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @d.healey
                      last edited by ustk

                      @d-healey Don't pay attention... Was just an idiot... Synth.getMidiProcessor(id)

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

                      1 Reply Last reply Reply Quote 1
                      • d.healeyD
                        d.healey @Christoph Hart
                        last edited by d.healey

                        @Christoph-Hart said in GetAllComponents:

                        in fact it's so easy that David could do it himself :)

                        Turns out you were correct! I've done it. I'll try doing it for effects and script processors too then I'll make a pull request!

                        Update: I've added a getAllEffects function. I don't think I'll bother with one for script processors as the simple solution I posted above works just fine.

                        I've created pull requests but if you want the changes sooner they are available in the getAllFunctions branch of my fork.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

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

                        53

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts