From a9a43583f610395010efd9e9dc82496225a51845 Mon Sep 17 00:00:00 2001 From: newspacer Date: Thu, 28 Nov 2024 17:55:42 +0100 Subject: [PATCH 1/2] added helper function MidiOutput::hasPendingMessages() --- modules/juce_audio_devices/midi_io/juce_MidiDevices.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.h b/modules/juce_audio_devices/midi_io/juce_MidiDevices.h index b22de5a8849a..ce5911aede22 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(); From ee79fffa0df1c38cd37ac2027cc25e9690803c40 Mon Sep 17 00:00:00 2001 From: newspacer Date: Thu, 28 Nov 2024 17:57:06 +0100 Subject: [PATCH 2/2] added helper function MidiOutput::hasPendingMessages() --- modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp b/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp index 23b02c654167..0261793442f5 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);