MidiMessageCollector possible bug

midiMessageCollector.removeNextBlockOfMessages (buffer, 0);

this causes a division by zero exception on line 106 of juce_MidiMessageCollector.cpp:

scale = (numSamples << 10) / numSourceSamples;

I also have a question, i use the collector giving it a sample rate of 44100 witch is fake, since i use no audio devices, and i want to remove ALL messages in it
when my AsyncUpdater triggers, what value should i pass as the second parameter to make sure i get them all, 0 gives me that error, should i specify some
very large int here ?


Thanks. I’m not going to make it handle a size of zero, but I will note in the comments that a non-zero size is a precondition, and I’ll add an assertion to check that.

To clear the buffer, why not just call reset() ? Using a large (but not too large) number would do the trick, but would be a really inefficient way to do it.


Could i call reset in a timerCallback() at some “longer” (30 seconds or so) intervals of “nothings happening” ?


You can call it whenever you like, I think.