"Slow" GUI Update

Topics: Debugging, Editor UI, Midi, Newbie, Performance, Plugin Development
Apr 14, 2012 at 4:15 PM

Hello and thanks for sharing VST.NET.

I would like to use your library to create a custom "midi info" GUI plugin- my goal is to simply report midi-related info on a custom GUI editor (no remapping, no sound generation, no audio processing). As a starting point, I modified your MidiNoteMapper (c# code from source r66567) such that:

a. MidiProcessor: ignores the mapping settings and simply adds every Note On message to the NoteOnEvents Queue
b. MidiNoteMapperGUI: add label control
c. MidiNoteMapperGUI: Declare/initialize a NoteOns List<Byte> object
d. MidiNoteMapperGUI:On ProcessIdle Event: add dequeued noteNo value to NoteOns list and show list count using label:

                lock (((ICollection)NoteOnEvents).SyncRoot)
                    noteNo = NoteOnEvents.Dequeue();

                NoteOns.Add(noteNo);  //NEW
                label1.Text = NoteOns.Count.ToString();   //NEW

                //SelectNoteMapItem(noteNo);  //Original uncommented

Everything works as expected, except that the GUI refresh seems "slow": if I press down five notes at once on my midi controller, I can "see" the GUI label actually incrementing to 5 (i.e. it takes about 1/2 second for the GUI label to get to 5, which seems "slow". Is there any way to speed this up, i.e. pressing 5 notes shows 5 much more quickly?

I don't believe this "slow" performance is a function of my ASIO driver settings-  I didn't observe any change if the ASIO buffer was at a small or large value.

I've observed this behavior using two different midi controllers and in two different hosts (Vst Host and Reaper).
My system is configured to play standard VST instruments without dropouts, crackles, etc.

My system specs:
Core 2 Duo (2.54 GHz)
Win7 32 SP1
VS2010 SP1 (targeting the 2.0 framework)
**** NOTE: I'm referencing the compiled versions of your dlls from release 0.9 ****

Could you shed any insight as to what is happening or what I'm doing wrong?

Thanks again for your time.

Apr 14, 2012 at 11:16 PM

Well, first thing that strikes me is that the ProcessIdle method on the UI only processes one event, even when there are (potentially) more on the queue.

So setting up a loop inside the lock should at least process all events available.

Get back to me if that doesn't fix your problem.

Hope it helps,

Apr 15, 2012 at 4:51 PM

Thanks for pointing out that the problem was a result of the code logic. After modifying my code, I am now getting "instant" performance, i.e.:

                lock (((ICollection)NoteOnEvents).SyncRoot)

                    while (NoteOnEvents.Count != 0)

                label1.text = NoteOns.Count.ToString();


Your help is very much appreciated.