I am working on a simple tuner VST plugin. You play a tone, I do some FFT/other math, and I change a label in the plugin to show the note and octave. Simple.
My plugin has two simple elements, from the ProJUCEr setup:
- class MyAudioProcessor : public AudioProcessor
- class MyAudioProcessorEditor : public AudioProcessorEditor, public Timer
My plan is to read off new buffer samples in MyAudioProcessor::processBlock(), put them in a sampleBuffer (readable by MyAudioProcessorEditor), and then, every 50ms (?) or so, have the MyAudioProcessorEditor::timerCallback() pull off samples, perform the FFT, and update the GUI.
(With only one exception, all the integer read/write heads will be writeable by only the AudioProcessor OR the AudioProcessorEditor. That last one I’ll have to setup as atomic or something?)
Is this a reasonable architecture? I chose this way since I was told you want to do as little in the processBlock() audio thread as possible.
However I’ve never used JUCE or C++ before so I’m looking for some advice on setting up good plugin design, and I wasn’t sure if the editor thread would be prioritized by the OS, etc! Thanks.