Lua sends out all midimessages @ panel loaded state – possible to disable? -1194

Home Forums General Programming Lua sends out all midimessages @ panel loaded state – possible to disable? -1194

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #5539
    Hecticcc
    Participant
      • Topics: 25
      • Replies: 160
      • Total: 185
      • ★★

      I have noticed that when i load my panel, it sends a burst of sysex messages before drawing the layout/modulators. The “burst” contains ALL sysex strings setup to be sent out if/when a modulator changes value, all these strings come from Lua scripts attached to the modulators.

      It is pretty annoying because this way it overwrites the current settings on the device with the settings of the modulators in the panel, thus completele altering the patch settings.

      Is there a way to avoid this problem or is this “standard” lua behaviour that needs some kind of workaround?

       

      #5540
      Hecticcc
      Participant
        • Topics: 25
        • Replies: 160
        • Total: 185
        • ★★

        Found a small workaround,   working on it got me thinking about why this happens.

        Is this logic right?  (Atom?)

        Panel loads, lua scripts \canvas\…load, modulators are created and get values that were remembered @ last closed, lua sees all these modulators change value and triggers scripts.

        #5541
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          Something like that yes.

          #5542
          Hecticcc
          Participant
            • Topics: 25
            • Replies: 160
            • Total: 185
            • ★★

            Ok good to know i am on the right track, thanks Atom.

            #5560
            TK.
            Participant
              • Topics: 6
              • Replies: 42
              • Total: 48

              In my panels I’m using a variable to disable MIDI messages.

              Filtering is enabled in the hook which is called before any modulators are created, and it’s disabled in the hook which is called when the panel has finished loading.

              I’m also using this mechanism from a hook which processes incoming SysEx messages – so, it was available anyhow, and didn’t result into additional overhead.

              Best Regards, Thorsten.

              #5566
              Hecticcc
              Participant
                • Topics: 25
                • Replies: 160
                • Total: 185
                • ★★

                Thorsten,

                thanks for the tip, i understand what you mean but cannot entirely visualise how to do this in code.

                Would you mind posting a small snippet to enlighten me?

                #5586
                TK.
                Participant
                  • Topics: 6
                  • Replies: 42
                  • Total: 48

                  No Problem!

                  This function is hooked into the “before any modulators are created” hook, which you can specify in the main configuration of your panel:

                  [code]
                  function init ()
                  console(“init”)

                  disableMidiMessages = true
                  end
                  [/code]

                  And this function is hooked into the “panel has finished loading” callback:
                  [code]
                  function postInit ()
                  console(“postInit”)

                  disableMidiMessages = false
                  end
                  [/code]

                  Whenever a modulator calls a Lua function, I’m writing:

                  [code]
                  sendLfo = function(modulator, newValue)

                  if( disableMidiMessages ) then
                  return
                  end

                  [/code]

                  And in the SysEx receive function, which transfers a received value to a modulator, I’m writing:
                  [code]

                  local prevDisableMidiMessages = disableMidiMessages
                  disableMidiMessages = true — global
                  modulator:setModulatorValue(value, notify_vst_host, notify_midi_device, notify_component)
                  disableMidiMessages = prevDisableMidiMessages — global

                  [/code]

                  Best Regards, Thorsten.

                  P.S.: sorry for the bad formatting – it seems that this forum can’t handle common BBCodes correctly

                  • This reply was modified 11 years, 3 months ago by TK..
                  #5590
                  atom
                  Keymaster
                    • Topics: 159
                    • Replies: 2945
                    • Total: 3104
                    • ★★★★★

                    Just use normal HTML,

                     for code blocks

                    , looks nice. I’ll try to add some new bbcode funcionality, some is there:

                     

                    • This reply was modified 11 years, 3 months ago by atom.
                    • This reply was modified 11 years, 3 months ago by atom.
                    • This reply was modified 11 years, 3 months ago by atom.
                    Attachments:
                    You must be logged in to view attached files.
                    #5596
                    Hecticcc
                    Participant
                      • Topics: 25
                      • Replies: 160
                      • Total: 185
                      • ★★
                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • The forum ‘Programming’ is closed to new topics and replies.
                    There is currently 0 users and 170 guests online
                    No users are currently active
                    Forum Statistics
                    Threads: 2,495, Posts: 17,374, Members: 77,605
                    Most users ever online was 12 on January 22, 2019 3:47 pm
                    Ctrlr