diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp index 23b02c65416..0261793442f 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp @@ -98,6 +98,11 @@ void MidiOutput::sendBlockOfMessages (const MidiBuffer& buffer, notify(); } +bool MidiOutput::hasPendingMessages() const +{ + return firstMessage != nullptr; +} + void MidiOutput::clearAllPendingMessages() { const ScopedLock sl (lock); diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h index b22de5a8849..ce5911aede2 100644 --- a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h +++ b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h @@ -421,6 +421,9 @@ class JUCE_API MidiOutput final : private Thread double millisecondCounterToStartAt, double samplesPerSecondForBuffer); + /** Returns true if there are pending midi messages */ + bool hasPendingMessages() const; + /** Gets rid of any midi messages that had been added by sendBlockOfMessages(). */ void clearAllPendingMessages();