I build an arpegiattor like plugin. For now, my plugin is very simple : I have a big button that can toggle the playing state of the processor. My processor plays a very simple list of notes :
I have a little sequencer that uses the processor samplerate / buffersize / playhead to make the conversion between musical time and sample time. And all works well with Reaper, and Studio One.
My problem is when I use FL Studio, the bigger the buffe size is, the faster my midi messages are sent. I don’t understand this difference. When I put a little buffer (256 samples per block) my little “melody” is almost played at the correct rate.
Have you tried setting the fixed-buffer sizes checkbox in the plugin settings? Sorry, it’a long time since I used FL, but from what I remember its buffer sizes are extremely ‘variable’ and likely to change quite a lot between calls to the audio processBlock() method.
Furthermore, I displayed the buffer size and the samplerate in my plugin, and they are stable. Is it possible FL Studio changes them without notifying my plugin ?
EDIT : Eventually I found it. And it worked.
So how to correctly handle it in my code ? I mean, currently I use the buffer size and samplerate given by the prepareToPlay method. How to get the “true” values if those ones aren’t valid.
You can query the size of the buffer each time processBlock() is called. To be honest, I’ve never had to deal with this issue myself, but I remember the variable buffer sizes in FL causing me grief in the past.
Yeah. It’s a good test DAW. It’s buffer size can go down to 1 sample! It tells you that you must treat the process as a single stream of data, and not to presume there’s time before your buffer loop to do any setup stuff.