Controlling the ide with midi


this is not very important but for convenience I wanted a system-wide shortcut to bring up the gui of a particular plugin, and thought that I could try to control the ide via midi like this:

MIDIFunc.noteOn({arg ...args; "here".postln; AppClock.sched(0.0,{~bs.gui})})

But it does not work. When I trigger this function with a midi-message the “here” gets posted but the gui produces this error:

ERROR: Qt: You can not use this Qt functionality in the current thread. Try scheduling on AppClock instead.
ERROR: Primitive '_QWindow_AvailableGeometry' failed.

Is there a way around this error?

Tried and failed to reproduce it… but, some findings…

The VSTPluginGui is calling Window.availableBounds to find out how big a window it can make. This is fine on my system. AFAICS from the sources, the only way this error could be posted is if it’s not on AppClock. So somehow, on my machine, AppClock.sched actually runs it on AppClock, but on yours, it doesn’t…? But only in this specific case…? Something is fishy.

Which OS?


I am on Debian testing.

Often it’s good to try a minimal example that reproduces the conditions of the error.

So what we know is: You have an incoming MIDI message. This means the action function runs on SystemClock. Your code example correctly schedules the GUI call on AppClock.

To reproduce it, we can use an OSC message, because OSC responses also run on SystemClock.

OSCdef(\test, {
	defer { w = Window("test", Rect(800, 200, 500, 400)).front };
}, '/test');


// result:
-> a NetAddr(, 57120)
clock: class SystemClock

… and the window appears (so the AppClock bit is definitely running on AppClock – defer { } is just a shortcut for AppClock.sched(0, { })).

Could you try this minimal case?


This works.

I get the expected output and the window appears.

Ok, good, then AppClock isn’t broken.

Can you try the OSCFunc with ~bs.gui instead? (And, if the error occurs again, can you include the full stack trace?)

Anything special about the way you’re creating the VSTPluginController?