Home › Forums › General › Programming › Lua sends out all midimessages @ panel loaded state – possible to disable? -1194
Tagged: lua midimessage loaded
- This topic has 8 replies, 3 voices, and was last updated 11 years, 3 months ago by Hecticcc.
-
AuthorPosts
-
January 13, 2013 at 4:57 pm #5539
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?
January 13, 2013 at 5:28 pm #5540Found 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.
January 13, 2013 at 7:14 pm #5541Something like that yes.
January 13, 2013 at 8:18 pm #5542Ok good to know i am on the right track, thanks Atom.
January 14, 2013 at 9:27 pm #5560In 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.
January 14, 2013 at 10:35 pm #5566Thorsten,
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?
January 15, 2013 at 8:02 pm #5586No 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..
January 16, 2013 at 12:42 am #5590Just 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.January 16, 2013 at 12:10 pm #5596Thanks Thorsten 🙂
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.