I am working on my first vst plugin using juce.
My goal is fairly simple; to create a tempo synchronized gating effect that simply switches the sound on and off.
Using the demo plugin, and stripping it down to the gainer, I’ve determined how to use ppq and/or samplerate/bpm to determine when the sound should be switched on or off, but I seem to be taking the wrong approach to get the timing right.
Whenever processBlock is called, I check against the current ppqPosition and set applyGain to 1 or 0. This works, but the timing is only as accurate as AudioSampleBuffer which is determined by the soundcard settings.
I’m pretty sure I need to do something on a sample-by-sample basis within the block, using the samplerate/bpm to determine the switch of the gain. This I can determine the math for myself.
My question is how to work on a sample-by-sample basis within processBlock? Would that be the right approach? I am seeking to get the timing as accurate as 12 cycles per beat depending on the input variable. Once I determine this, I will then add smoothing and some other features.