From 82e1c7483e2bf712dad06bffe7c7c5eea92e1813 Mon Sep 17 00:00:00 2001 From: Oliver James Date: Mon, 16 Oct 2023 11:09:59 +0100 Subject: [PATCH] AudioWorkgroup: Update documentation --- .../utilities/juce_AudioWorkgroup.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h b/modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h index c81f288d5b..72681cf7ea 100644 --- a/modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h +++ b/modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h @@ -105,21 +105,33 @@ private: Here's an example of how you might use this class: @code + Constructor() + { + startRealtimeThread (RealtimeThreadOptions{}.withApproximateAudioProcessingTime (samplesPerFrame, sampleRate)); + or + startRealtimeThread (RealtimeThreadOptions{}.withProcessingTimeMs (10)); + } + void Thread::run() override { WorkgroupToken token; getWorkgroup().join (token); - while (! threadShouldExit()) + while (wait (-1) && ! threadShouldExit()) { - // If the workgroup has changed, rejoin the workgroup with the same token + // If the workgroup has changed, rejoin the workgroup with the same token. if (workgroupChanged()) getWorkgroup().join (token); // Perform the work here } } + + void AudioProcessor::processBlock() + { + workerThread->notify(); + } @endcode @see Thread, AudioProcessor, WorkgroupToken