GUI in non-deferred script
I have a script I'm writing which has a simple GUI, the idea is that the various controls are set once and then never touched again while the instrument is in use - it's a kind of behind-the-scenes UI. The script also does a load of stuff in the note callbacks. I rather not have to use two separate scripts just so that I can defer the GUI so my question is will having these GUI controls - that won't be moved once set - affect the instrument's performance?
Duh I just realised that the On Control callback runs in the message thread anyway
If you are automating the parameter it will be executed in the message thread, the audio thread or even another dedicated automation track (depending on the host software).
But the "Defer callbacks of the Interface" advice is just useful if you are doing graphical related stuff in the midi callbacks (like updating a label or changing the key colours). If they are empty or only doing "audio stuff", keep them in the audio thread.
That's good to know. One thing I've noticed is that if the note off callback is deferred then
Message.ignoreEvent(true);has no effect.
Yes this is intended. When the deferred callback gets executed in the message thread, the audio thread is way ahead so you can't use any methods that change the message event (I think I got a safe check which prints out an error if you try this, but maybe I forgot it on
That makes sense, thanks for confirming