Browse Source

AudioWorkgroup: Update documentation

v7.0.9
Oliver James reuk 2 years ago
parent
commit
82e1c7483e
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
1 changed files with 14 additions and 2 deletions
  1. +14
    -2
      modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h

+ 14
- 2
modules/juce_audio_basics/utilities/juce_AudioWorkgroup.h View File

@@ -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


Loading…
Cancel
Save