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