HISE Logo Forum
    • Categories
    • Register
    • Login

    Is there a sure method of blocking MIDI messages immediately?

    Scheduled Pinned Locked Moved General Questions
    17 Posts 4 Posters 344 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.
    • VirtualVirginV
      VirtualVirgin @d.healey
      last edited by

      @d-healey said in Is there a sure method of blocking MIDI messages immediately?:

      @VirtualVirgin said in Is there a sure method of blocking MIDI messages immediately?:

      if (Message.getEventId() == eid)

      This will always be true, so you don't need it.

      This is just a test here,
      but it is not always true if there is intervening code in between the initial variable declaration and the "if "statement of it.

      If new notes are generated after the var eid = Message.getEventId();
      in the script they should return a "false".

      You can listen to my orchestral mockups here:
      https://www.virtualvirgin.net/

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

        @d-healey said in Is there a sure method of blocking MIDI messages immediately?:

        @VirtualVirgin said in Is there a sure method of blocking MIDI messages immediately?:

        So the Message.ignoreEvent(true) works, but not immediately.

        The message is ignored as soon as you tell it to be, but the message still exists in the processor you ignored it in so you can still see its properties like the note number.

        Ignoring just means it won't be processed any further in the chain, won't trigger sound generators, etc.

        But if note numbers are still passing to be picked up by the Console at the point, then they will also be picked up if I am pushing Message.getNoteNumber() into a MidiList or an array. I do not want that.

        You can listen to my orchestral mockups here:
        https://www.virtualvirgin.net/

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

          @VirtualVirgin said in Is there a sure method of blocking MIDI messages immediately?:

          Message.getNoteNumber() into a MidiList or an array. I do not want that.

          Can you show me an example where you would be adding it to a MIDI list so I can see the flow of your program?

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

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

            Here is a snippet of the test-

            HiseSnippet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eLlaNXDl29m.iI76eModudvAdJ.Wlz38KJY9su7O5ZVJupglFjXgEuK1CGbq2CiW597ZTm6n0nOlL8QgN5xOJTxpzbqiI1WydxSog1Ltm8N1sfbBOVyF8YJSFa5UXsmaYkm2ytv7rYuyN5HWyJOjl7S7fadBMiSEzzPPJxeNrPLObKIR5y1HHjClxjPMZh4eKrF38+91aStq1aemuq9AV1+GxxV59JK6x2iYYsHsZVqo8gilKAK92uV90Gn8df16AZu4V92JGoeywVTUHGdwQBLMzAncbYIulg9NHNm91RrriVV2A5vDdFA86.lXrnVFmXr3Di+moFCotgxO3FOAqYtdjQCzaEl+MT4Iszx1EQlo5r2WFBDoev0c1Tck.KsnA9CKZfkWz.2bQCbqEMvJKZfa+2GndO2KFojCiG+QH3UsMThXbcAEljLScn+BL0SNn
            

            There is a Console.print for the onNoteOn of two MIDI script processors.

            If the Message.ignoreEvent is on, then only the parent processor prints the note number.
            Screenshot 2024-11-06 at 5.42.08 PM.png

            If the Message.ignoreEvent is off, then they both print the note number.

            Screenshot 2024-11-06 at 5.41.15 PM.png

            So message is not being blocked immediately, as in the first condition, neither script processors should be printing anything onNoteOn.

            You can listen to my orchestral mockups here:
            https://www.virtualvirgin.net/

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

              @VirtualVirgin But where would you be adding it to a MIDI list or array, where the Console.print line is?

              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 The MidiList or array could be anywhere depending on what stage of note transformation is going on.

                You can listen to my orchestral mockups here:
                https://www.virtualvirgin.net/

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

                  @VirtualVirgin Until I know where it is I can't suggest a particular solution, but if it's in the same list where you are ignoring the note, you can just not add it to the list if you are ignoring the note.

                  And if it's in a secondary script the note will never reach it if it's ignored so there shouldn't be an issue. Unless I'm misunderstanding - it's tricky without a real-world example.

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

                  1 Reply Last reply Reply Quote 0
                  • A
                    aaronventure
                    last edited by aaronventure

                    That specific callback will always execute, the one where you called the ignore. Because it's a function and calling ignire doesn't prevent the execution of the function further (use return for that). But if you have any other sibling midi processors right after or child processors, the ignored message will not show up there.

                    Also, initializing variables inside the on note function is a big nono. Do it in on init.

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

                      @aaronventure said in Is there a sure method of blocking MIDI messages immediately?:

                      Also, initializing variables inside the on note function is a big nono. Do it in on init.

                      I think in this case changing the var to local would be sufficient.

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

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @d.healey
                        last edited by aaronventure

                        @d-healey it's not an inline function, tho?

                        The thread guard is gonna be giving you a hard time about it on every note you press

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

                          @aaronventure Local variables can be used it the default callbacks, even though they are not inline functions. I haven't had any issues with this when using them to store and manipulate values that are already within the callback, such as Message properties. I assume the HISE compiler will swap them out for their actual value- or do some other magic.

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

                          Christoph HartC A 2 Replies Last reply Reply Quote 0
                          • Christoph HartC
                            Christoph Hart @d.healey
                            last edited by

                            I think in this case changing the var to local would be sufficient.

                            This. local variables can be used in both inline functions and inbuilt MIDI callbacks and will not allocate any memory for simple types (numbers).

                            HISE compiler will swap them out for their actual value- or do some other magic.

                            No, it just preallocates the storage when compiling the callback.

                            1 Reply Last reply Reply Quote 3
                            • A
                              aaronventure @d.healey
                              last edited by aaronventure

                              @d-healey Wow that's actually great, somehow I missed this. Nice!

                              It was a bit annoying having to go back and declare a few variables just for carrying data throughout the function, but I guess I had just unquestioningly accepted it and never wondered why there wasn't an easier way of doing it.

                              Pretty silly on my end, in retrospect. I guess I was just cucked by the Thread Guard which stopped me from having any super bright ideas about memory stuff from within the realtime callbacks.

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

                                @aaronventure better safe than sorry :) but yes, the requirement for non-allocating local number variables was one of the first things I hacked into the scripting engine.

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

                                34

                                Online

                                1.8k

                                Users

                                12.1k

                                Topics

                                105.2k

                                Posts