HISE Logo Forum
    • Categories
    • Register
    • Login

    Need a little help with (HISE) loops

    Scheduled Pinned Locked Moved General Questions
    16 Posts 4 Posters 283 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 @gorangrooves
      last edited by

      @gorangrooves you mis-spelt length..

      MapCombos.lenght
      

      HISE Development for hire.
      www.channelrobot.com

      gorangroovesG 1 Reply Last reply Reply Quote 0
      • gorangroovesG
        gorangrooves @Lindon
        last edited by

        @Lindon Thank you. That resolved one bit, but my script is still not working. It compiles, but it doesn't do what I am expecting.

        This is the latest:

        for (i = 0; i < MapCombos.length; i++)
            {
        		var Box = MapCombos[i];
        
                inline function onBoxControl(component, value)
                {
        	       noteTriggers[i] = value - 1;
        	       setKeyColours();
                };
        
        		Box.setControlCallback(onBoxControl);
            }
        

        What am I missing / doing wrong?

        Goran Rista
        https://gorangrooves.com

        Handy Drums and Handy Grooves
        https://library.gorangrooves.com

        Dan KorneffD 1 Reply Last reply Reply Quote 0
        • Dan KorneffD
          Dan Korneff @gorangrooves
          last edited by

          @gorangrooves What about putting the loop inside your function?

          inline function onBoxControl(component, value)
          {
               for (i = 0; i < MapCombos.lenght; i++)
               {
                  var Box = MapCombos[i];
          	noteTriggers[i] = value - 1;
               }
               setKeyColours();
          };
          
          Content.getComponent(Box).setControlCallback(onBoxControl);
          
          

          Dan Korneff - Producer / Mixer / Audio Nerd

          gorangroovesG 1 Reply Last reply Reply Quote 0
          • gorangroovesG
            gorangrooves @Dan Korneff
            last edited by

            @Dan-Korneff Thanks, Dan. Unfortunately, that doesn't work either. It throws an error

            column 21: Argument 0 is undefined! 
            

            on this line

            Content.getComponent(Box).setControlCallback(onBoxControl);
            

            And If I put it like this:

            Content.getComponent("Box").setControlCallback(onBoxControl);
            

            I get this error on that last line:

            column 47: Unknown function 'setControlCallback'
            

            O, thou Loop Wizard, @d-healey, could you please enlighten me?

            Goran Rista
            https://gorangrooves.com

            Handy Drums and Handy Grooves
            https://library.gorangrooves.com

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

              @gorangrooves You can't declare an inline function inside a loop, that is just weird :p

              Post a snippet and I'll fix it :)

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

              gorangroovesG 1 Reply Last reply Reply Quote 0
              • gorangroovesG
                gorangrooves @d.healey
                last edited by

                @d-healey Ok. Thank you. If I export a HISE snippet from my entire current project, will that work despite missing all of the images for buttons, sliders etc, as well as the actual samples?

                Goran Rista
                https://gorangrooves.com

                Handy Drums and Handy Grooves
                https://library.gorangrooves.com

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

                  @gorangrooves Don't make one for your entire project. Just make a minimal one that demonstrates the issue.

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

                  gorangroovesG 1 Reply Last reply Reply Quote 0
                  • gorangroovesG
                    gorangrooves @d.healey
                    last edited by

                    @d-healey Uh, I'll try. There are several intervened elements.

                    Goran Rista
                    https://gorangrooves.com

                    Handy Drums and Handy Grooves
                    https://library.gorangrooves.com

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

                      @gorangrooves Often the process of making a simplified snippet will reveal where the true issue is - I do this all the time if I'm trying to solve an issue in a complicated project.

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

                      gorangroovesG 1 Reply Last reply Reply Quote 0
                      • gorangroovesG
                        gorangrooves @d.healey
                        last edited by

                        @d-healey Got you. I think I'll make a copy of one of the projects, then strip it down naked 😁

                        Goran Rista
                        https://gorangrooves.com

                        Handy Drums and Handy Grooves
                        https://library.gorangrooves.com

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

                          @gorangrooves You might also want to look at some of my tutorials where I'm building interfaces with controls stored in arrays and how I reference those controls inside the callback.

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

                          gorangroovesG 1 Reply Last reply Reply Quote 0
                          • gorangroovesG
                            gorangrooves @d.healey
                            last edited by

                            @d-healey I did. I love them. Everything made perfect sense. Then I attempted to make my own...the rest is history 😂

                            Goran Rista
                            https://gorangrooves.com

                            Handy Drums and Handy Grooves
                            https://library.gorangrooves.com

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

                              @gorangrooves Something like this

                              for (i = 0; i < MapCombos.length; i++)
                              {
                              	MapCombos[i].setControlCallback(onBoxControl);
                              }
                              
                              inline function onBoxControl(component, value)
                              {
                              	local index = MapCombos.indexOf(component);
                              
                              	noteTriggers[index] = value - 1;
                              	setKeyColours();
                              };
                              
                              

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

                              gorangroovesG 1 Reply Last reply Reply Quote 0
                              • gorangroovesG
                                gorangrooves @d.healey
                                last edited by

                                @d-healey Thanks so much, you wizard! I think that is the way to go.

                                The notes and comboboxes are not quite matching at the moment, but I think I need to do some untangling, perhaps. You helped me overcome a major hurdle. Thank you so much!

                                Goran Rista
                                https://gorangrooves.com

                                Handy Drums and Handy Grooves
                                https://library.gorangrooves.com

                                gorangroovesG 1 Reply Last reply Reply Quote 1
                                • gorangroovesG
                                  gorangrooves @gorangrooves
                                  last edited by

                                  @d-healey Yes, I got it all sorted and implemented another feature to learn MIDI notes using a loop. Thanks so much again for the personal help and for your helpful videos!

                                  Goran Rista
                                  https://gorangrooves.com

                                  Handy Drums and Handy Grooves
                                  https://library.gorangrooves.com

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

                                  45

                                  Online

                                  1.7k

                                  Users

                                  11.7k

                                  Topics

                                  101.8k

                                  Posts