Hello, everyone. I’m hoping someone can help me out, because I seem to be missing something, despite several hours of research and experimentation.
I’ve created a sine wave synth as a VST Plugin, following the example set forth in the tutorial found at the link I’ve posted below:
https://docs.juce.com/master/tutorial_synth_using_midi_input.html
I am getting a lot of crackling in my synth when I actually trigger it with my midi keyboard within (my host application) Reaper. I think it is because I have set the (int) startSample argument within synth.renderNextBlock() to zero, which I did because I could not find a way to get the startSample from the buffer, as is possible from within a standalone AudioApp during the getNextAudioBlock() call.
synth.renderNextBlock (*bufferToFill.buffer, incomingMidi,
bufferToFill.startSample, bufferToFill.numSamples); // [5]
So my question is this: without the AudioSourceChannelInfo providing bufferToFill.startSample, how do I get this same information from the straight AudioBuffer that is provided by PluginProcessor::processBlock()?
Do I need to count the samples that pass from the original NoteOn event and use the last count to set the startSample argument? That was my most recent guess, but I have yet to attempt an implementation. Or should the startSample be derived from some other host-provided data that I’m unaware of?
Thanks in advance for any and all assistance!