MidiMessageCollector dismissing some events


#1

Hi Jules,

I wonder what is the purpose of this code in MidiMessageCollector:

[code] const int maxBlockLengthToUse = numSamples << 5;

        if (numSourceSamples > maxBlockLengthToUse)
        {
            startSample = numSourceSamples - maxBlockLengthToUse;
            numSourceSamples = maxBlockLengthToUse;
            iter.setNextSamplePosition (startSample);
        }

[/code]

When the audio callback is being called with very irregular timings (pulseaudio here, but I think it also happens sometimes with directsound) , the condition “numSourceSamples > maxBlockLengthToUse” is sometimes true and as a consequence the iter is moved to ‘startSample’ and every midi event before this startSample value is going to be just skipped.


#2

Well, if that wasn’t there, then skipping forward in a file would make it play all the intervening notes, no matter how large the distance. I guess you could argue that the maximum time I chose could be larger though.