Automation doesn't work in FL Studio


Hello, I created a VST plugin using JUCE and it has separate GUI class and separate class inheriting AudioProcessor. The communication between GUI and AudioProcessor is provided with a timer created in GUI class. The timer has interval set to 200ms and whenever a parameter change occurs, the timer from GUI checks if parameterChanged flag was set in processor and updates the changes to GUI. The problem is that automation doesn't work for FL studio for this plugin. In a different thread on this forum, I read that the AudioProcessor method setParameterNotifyingHost MUST be called by the message thread. (As far as I understand, message thread is my GUI?)

Now the question is how do I do that correctly? The AudioProcessor thread collects midi messages in its processBlock method and there's no way it can take a pointer to GUI. Should I add some kind midi messages stack to the AudioProcessor and then check if there is something in it every timer tick from GUI thread and call the setParameterNotifyingHost from GUI thread? This solution is very ugly because that'd add some big latency and I'm afraid that for more frequent timer tick rates it might crash or something....

Please help!