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 :
MidiMessages cOn = MidiMessage::noteOn(1, 60, 1.0f); //quarter note
MidiMessages eOn = MidiMessage::noteOn(1, 64, 1.0f); //quarter note
MidiMessages gOn = MidiMessage::noteOn(1, 67, 1.0f); //half note
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.
Does somebody have an idea? ? ^^
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
Thank you for your answer.
I tried to test your advice, but I didn’t find this option in my audio settings.
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.
0k, thank you for the advices, now it works !
I use the processBlock audiobuffer size to increment my play time instead of the buffer size given by the prepare to play
Yep, I use the prepareToPlay parameter as just giving the maximum number of samples possible.