MacOS AudioWorkgroup example code

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

Never done anything like this, but from reading the docs, it looks like:

  1. AudioIODeviceType::createAudioIODeviceType_CoreAudio()
  2. audioIODevice.getWorkgroup()
  3. follow example code you posted above