Hi, I’m trying to use the new AudioWorkgroup
feature in JUCE. I tried following the example provided here but I couldn’t get it working. It’s not clear what getWorkgroup()
should be called on. Here is the code I have so far which isn’t working. Any help would be appreciated. Thanks!
class Worker : private juce::Thread
{
public:
Worker(int samplesPerFrame, double sampleRate)
: Thread ("Worker Thread")
{
startRealtimeThread(RealtimeOptions{}.withApproximateAudioProcessingTime(samplesPerFrame, sampleRate));
}
void run() override
{
juce::WorkgroupToken token;
getWorkgroup().join(token);
while (wait(-1) && !threadShouldExit())
{
// If the workgroup has changed, rejoin the workgroup with the same token.
if (workgroupChanged())
getWorkgroup().join(token);
// Perform the work here
}
}
}