From db17713aad289b2fa013e646de45bff6c4412e2b Mon Sep 17 00:00:00 2001 From: attila Date: Wed, 4 May 2022 11:56:06 +0200 Subject: [PATCH] AudioProcessor: Add isRealtime() --- .../processors/juce_AudioProcessor.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h index c555541883..a1e398085b 100644 --- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h +++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h @@ -71,6 +71,12 @@ public: doublePrecision }; + enum class Realtime + { + no, + yes + }; + using ChangeDetails = AudioProcessorListener::ChangeDetails; //============================================================================== @@ -916,6 +922,21 @@ public: */ bool isNonRealtime() const noexcept { return nonRealtime; } + /** Returns no if the processor is being run in an offline mode for rendering. + + If the processor is being run live on realtime signals, this returns yes. + If the mode is unknown, this will assume it's realtime and return yes. + + This value may be unreliable until the prepareToPlay() method has been called, + and could change each time prepareToPlay() is called. + + @see setNonRealtime() + */ + Realtime isRealtime() const noexcept + { + return isNonRealtime() ? Realtime::no : Realtime::yes; + } + /** Called by the host to tell this processor whether it's being used in a non-realtime capacity for offline rendering or bouncing. */