Question about sending MidiMessages' timestamp out of buffer


#1

Hi everyone,

If you send a MidiMessage with a timestamp out of block size in AudioProcessor::processBlock() a jassert is triggered in class Juce_VST_Wrapper. Line 618

 

            while (i.getNextEvent (midiEventData, midiEventSize, midiEventPosition))
            {
                jassert (midiEventPosition >= 0 && midiEventPosition < numSamples);

                outgoingEvents.addEvent (midiEventData, midiEventSize, midiEventPosition);
            }

 

As you can't know the exact host buffer size for each processBlock calls, some MidiMessages than you send to the host via processBlock method may be out of sample buffer.

Would there be a problem if I send MidiMessages (notes) out of buffer?

Regards,

Oscar

 

 

 

 

 

 


#2

You do know the number of samples - it's the same as the size of the audio buffer.

Obviously returning messages that are out-of-range is going to ruin the timing, even if it doesn't break anything.