Home › Forums › General › Programming › midiMessageReceived executed 2 times
- This topic has 5 replies, 2 voices, and was last updated 7 years, 9 months ago by goodweather.
-
AuthorPosts
-
June 22, 2016 at 8:40 pm #69481
Hi,
I have a somewhat similar behaviour as described in http://ctrlr.org/forums/topic/large-sysex-dump-problem/ but when using Ctrlr standalone.
Current version of Ctrlr I’m using is 5.3.174 (I will try with a more recent version to check if the problem is the same).The issue:
- You select a bank and a program then press on a Load button. The Load_OnChange method is triggered and calls RequestProgramEditBufferDump
- RequestProgramEditBufferDump method is rather simple: it builds a sysex message and sends it to the synth as:
msg = string.format("F0 01 2C 06 F7") panel:sendMidiMessageNow(CtrlrMidiMessage(msg))
- The midiMessageReceived method is associated to the panel property “Called when the panel received a midi message”. It checks the message size and acts accordingly
- As you can see in the attached image showing the MidiMonitor window and the Console, each method is called once but MidiMessageReceived is reacting on the same message size 2 times WHILE in the output I got only the message once (and the message is correct btw)
Any clue why midiMessageReceived could be triggered twice for only one message?
@Atom: hope you’ll get a chance to lok at this 🙂I will use a temporary workaround to check some bytes for detecting double execution and to avoid launching all actions in midiMessageReceived twice.
Thx in advance…
Attachments:
You must be logged in to view attached files.June 23, 2016 at 1:09 pm #69489OK… I’m quite sure it is a bug…
Instead of using the workaround I mentioned when initiating the post (checking a few bytes), I did as daimondamps mentioned in its topic http://ctrlr.org/forums/topic/large-sysex-dump-problem/: resetting and restoring the Midi devices with PanelLoaded().
So, just add the following code in PanelLoaded() and midiMessageReceived() will be only executed once:
sDevices = panel:getProperty("panelMidiControllerDevice") panel:setPropertyString("panelMidiControllerDevice", "-- None") panel:setPropertyString("panelMidiControllerDevice", sDevices)
Works fine 🙂
July 16, 2016 at 11:55 am #69554Well…
It worked fine until I realized that I lost the bidirectional behaviour of my panel…The solution I found was to reset the Input devices at panel load and this is working fine (no double execution of MidiMessageReceived for one message and bidi is OK):
-- Reset Midi INPUT devices to avoid having MidiMessageReceived method called twice -- If resetting Controller devices then the bidirectional behaviour is lost (most probably a bug) sMidiDevices = panel:getProperty("panelMidiInputDevice") panel:setPropertyString("panelMidiInputDevice", "-- None") panel:setPropertyString("panelMidiInputDevice", sMidiDevices)
July 16, 2016 at 12:32 pm #69555Hi goodie, I finally checked this out and yes you are right and your simple workaround seems to work too. Thanks! Unfortunately there does not seem to be such an easy fix for the vstplugin version sending midi messages twice, which I think could get one into trouble, depending on the synth and the panel you are using…
edit: I just read that you think resetting the input (or output) devices could fix this too. Well it’s worth a try. Will report if this fixes it. That would be great!
- This reply was modified 7 years, 9 months ago by Possemo.
July 16, 2016 at 1:48 pm #69557No, unfortunately this wont fix it. I tried this:
local vstout = panel:getProperty("panelMidiOutputToHost") panel:setProperty("panelMidiOutputToHost",0,false) panel:setProperty("panelMidiOutputToHost",vstout,false)
It must be a bug in panelMidiOutputToHost because if you set a mididevice in panelMidiOutputDevice it will send messages three times. So panelMidiOutputToHost will always send messages twice X-(. Maybe one day I will find a workaround…
July 16, 2016 at 6:16 pm #69558OK. When my Pro2 panel will be ready in standalone, for sure I’ll try the VST and I may face this issue…
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.