mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioWorkgroup: Update documentation
This commit is contained in:
parent
5c8b7fe0e1
commit
82e1c7483e
1 changed files with 14 additions and 2 deletions
|
|
@ -105,21 +105,33 @@ private:
|
||||||
Here's an example of how you might use this class:
|
Here's an example of how you might use this class:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
Constructor()
|
||||||
|
{
|
||||||
|
startRealtimeThread (RealtimeThreadOptions{}.withApproximateAudioProcessingTime (samplesPerFrame, sampleRate));
|
||||||
|
or
|
||||||
|
startRealtimeThread (RealtimeThreadOptions{}.withProcessingTimeMs (10));
|
||||||
|
}
|
||||||
|
|
||||||
void Thread::run() override
|
void Thread::run() override
|
||||||
{
|
{
|
||||||
WorkgroupToken token;
|
WorkgroupToken token;
|
||||||
|
|
||||||
getWorkgroup().join (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())
|
if (workgroupChanged())
|
||||||
getWorkgroup().join (token);
|
getWorkgroup().join (token);
|
||||||
|
|
||||||
// Perform the work here
|
// Perform the work here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioProcessor::processBlock()
|
||||||
|
{
|
||||||
|
workerThread->notify();
|
||||||
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@see Thread, AudioProcessor, WorkgroupToken
|
@see Thread, AudioProcessor, WorkgroupToken
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue