HISE Logo Forum
    • Categories
    • Register
    • Login

    Trouble with index variable for loop inside loop

    Scheduled Pinned Locked Moved Scripting
    16 Posts 4 Posters 364 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.
    • ustkU
      ustk @VirtualVirgin
      last edited by

      @VirtualVirgin @d-healey Yeah this bug is here since the premises of Hise, I reckon I pushed a fix one day but it has never been merged

      int ScriptingApi::Synth::internalAddNoteOn(int channel, int noteNumber, int velocity, int timeStampSamples, int startOffset)
      {
      	if (channel > 0 && channel <= 16)
      	{
      		if (noteNumber >= 0 && noteNumber < 127) // should be noteNumber <= 127
      		{
      

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

      1 Reply Last reply Reply Quote 2
      • ustkU
        ustk @VirtualVirgin
        last edited by

        @VirtualVirgin @d-healey Alright I fixed it and made a pull request

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

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

          Wowww... It appears this error is repeated in many places!

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

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

            @d-healey shouldn't a MIDI CC start from 0 to 127?

            When clicking on a slider to assign CC it goes from 1 to 126...

            Something is telling me Chris put a 1 for a reason...

            if (!isOnHiseModuleUI && getMacroIndex() == -1)
            	{
            		auto addNumbersToMenu = [&](PopupMenu& mToUse)
            		{
            			auto value = handler->getMidiControllerNumber(processor, parameterToUse);
            
            			for (int i = 1; i < 127; i++) // <= 1?
            			{
            				if (handler->shouldAddControllerToPopup(i))
            					mToUse.addItem(i + MidiOffset, handler->getControllerName(i), handler->isMappable(i), i == value);
            			}
            		};
            

            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 d.healey

              @ustk said in Trouble with index variable for loop inside loop:

              shouldn't a MIDI CC start from 0 to 127?

              Yes

              From the MIDI spec

              a6643dba-f473-4f39-abad-d902f5cd0c76-image.png

              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

                @d-healey Alright I pushed all the changes, hoping I didn't introduced any mistake...

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

                VirtualVirginV 1 Reply Last reply Reply Quote 1
                • VirtualVirginV
                  VirtualVirgin @ustk
                  last edited by VirtualVirgin

                  @ustk Does that mean I can build from the newest version to get these changes to take effect?

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

                    @VirtualVirgin You'll need to wait for Christoph to check and merge the changes, or you'll need to make a fork and pull in Ustk's changes to your fork.

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

                    VirtualVirginV 1 Reply Last reply Reply Quote 0
                    • VirtualVirginV
                      VirtualVirgin @d.healey
                      last edited by

                      @d-healey said in Trouble with index variable for loop inside loop:

                      @VirtualVirgin You'll need to wait for Christoph to check and merge the changes, or you'll need to make a fork and pull in Ustk's changes to your fork.

                      I don't have any forking experience so I'll wait on that, thanks :)

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

                        @ustk pull request looks OK, I guess I never bothered about that upper number too much, the only thing I'm not sure is whether to show CC#0 in the learn popup. Usually you start with CC #1 (the mod wheel) and this will affect all plugins. Does anyone else have an opinion on that?

                        d.healeyD ustkU VirtualVirginV 3 Replies Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @Christoph Hart
                          last edited by d.healey

                          @Christoph-Hart CC0 is bank select isn't it? If so I wouldn't show it in MIDI learn.

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

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

                            @Christoph-Hart yeah the cc0 learn was my concern too

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

                            1 Reply Last reply Reply Quote 0
                            • VirtualVirginV
                              VirtualVirgin @Christoph Hart
                              last edited by VirtualVirgin

                              @Christoph-Hart
                              I would think it's best just to let the user decide if they want to use it, like any other CC.

                              Now, upon testing the CC learn (I was curious to make sure it is blocking the consumed CCs at the output for use with MIDI plugins, and it does), but I must say that the CC learn being channel agnostic is not a good idea. This is not how most VST instruments will handle this.

                              Here in this simple MIDI utility I made, I just ran a test to check the channel filter operation in conjunction with the MIDI learn.

                              Screenshot 2024-11-12 at 11.28.22 AM.png

                              The MIDI learned control to CC#1 (Velocity Transpose Amount) is not affected by the channel filter, so even if my notes aren't going through, my CC values are.

                              The MIDI learns need to be channel selectable somehow in order to work in multitimbral settings where the VSTi endpoint is only meant to receive from one channel, otherwise you will have lots of unwanted CC messages going to the other channels/instruments.

                              Is there a way currently to make sure the CC learn can be filtered by channel?

                              I am not seeing channel selection in the MidiLearnPanel:
                              Screenshot 2024-11-12 at 11.59.53 AM.png

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

                              7

                              Online

                              1.7k

                              Users

                              11.8k

                              Topics

                              102.3k

                              Posts