ARA offers the possibility to control the audio playback, the start position, the loop, etc. To take full advantage of this capability via the plug-in interface, the plug-in must also be aware of this information from the host. This is possible by retrieving the AudioPlayHead
in the processBlock()
method. The problem is that with ARA, there can be several processor instances (juce::AudioProcessor
& juce::AudioProcessorARAExtension
) per plug-in actually loaded by the user. And these instances can have several roles depending on the host implementation and the context - ARAPlaybackRenderer
, ARAEditorRenderer
or even ARAEditorView
(for the graphical part).
If we want to display and control the AudioPlayHead
information, from which role should we get this information? I would say from the ARAPlaybackRenderer
. But I have a problem especially in Reaper (I have to do more tests with other host software):
In Reaper, when an ARA plug-in is loaded on a region (and not on a track), Reaper creates several instances of the processor (juce::AudioProcessor
& juce::AudioProcessorARAExtension
), one which is ARAPlaybackRenderer
+ ARAEditorView
and the other just ARAEditorRenderer
. Once the audio playback starts, the method getPlayHead()->getPosition()->getIsPlaying() returns true
in processBlock()
(which is obviously) in both instances of the processor. On the other hand, if we stop the audio playback, the processBlock()
method of the ARAPlaybackRenderer
+ ARAEditorView
instance is not called anymore, so for this instance the audio playback state is still active and the playhead position does not move, etc. As this is the instance used to retrieve the information (and also in charge of the GUI), the UI cannot be updated properly.
Should we use the AudioPlayHead
information from the ARAEditorRenderer
instance instead? This complicates the communication with the GUI. And is it compatible with all hosts?
I also note that it is better not to use the AudioPlayHead
information from all instances at the same time because due to the multithreaded approach, the information is not synchronized.
I hope the explanation is not too messy