Using the ARA Plugin Host Code on iOS

It would be convenient to be able to use the ARA plugin host code on iOS. To do this, we need to add a few JUCE_IOS definitions and ensure that JUCE_INTERNAL_HAS_VST3 and JUCE_INTERNAL_HAS_AU are not required, but nothing too intrusive (7–8 lines total at most). Would this be reasonable? I can create a PR if needed and/or just post the changes here.

To the best of my knowledge running ARA isn’t supported by AUv3 specifically due to issues related with running plugins out of process. So I wouldn’t expect iOS to be useful target for ARA. Have you managed to get something to work?

I develop standalone apps (not AUv3s) that function as a small host around an ARA plugin and are based on the Standalone format for a standard plugin. Here’s the modification needed to make it work: ARA: Add support for ARA plug-in hosts on iOS by pierreguillot · Pull Request #1740 · juce-framework/JUCE · GitHub.

PS. I already have three apps based on the Ircam ASAP plug-ins available on the App Store (‎IrcamLab sur iPhone - App Store), it’s free if you want to try it out. Here is an example: ASAP Psycho Filter (‎ASAP Psycho Filter App - App Store),

Just to make sure I understand correctly, are you statically linking some ARA plugin (that isn’t also using one of the standard companion APIs such as VST3 or AU) into a standalone application?

Yes, the plugin’s source code is statically linked. The main application inherits from juce::JUCEApplication and contains a juce::AudioProcessor member that is created using createPluginFilterOfType(juce::AudioProcessor::wrapperType_Standalone).

For what it’s worth, we have the same setup with an ARA plugin that is also available as standalone Application, where our standalone Application is a basic ARA host that directly links the static shared code target of the plugin. This is not on iOS though, but I rember having a hard time fiddling around with some preprocessor flags to make it build, felt more like a workaround than a supported use-case. So better support for this setup would be appreciated!

2 Likes

Are those the only changes you had to make? With the suggested diff bindDocumentToPluginInstance returns an invalid extension. How do you get the playback/editor renderer interfaces on the host side?

How is PlugInExtension::bindToARA called on the plugin side?

No, I don’t need any other changes on the JUCE side. I’m using my own classes for the ARA host (which is a very simple host with a single sequence and a single region). But here’s some pseudocode that should be more informative (it’s pretty much what’s actually used in my applications). If you need any other parts, feel free to ask.

audioProcessor = createPluginFilterOfType(juce::AudioProcessor::wrapperType_Standalone);
auto araFactory = juce::ARAFactoryWrapper(inializeARAFactory());
auto* araProcessor = dynamic_cast<juce::AudioProcessorARAExtension*>(audioProcessor.get());
documentController = juce::ARAHostDocumentController::create(  std::move(araFactory)
                                                                , "AraHostDocument"
                                                                , std::make_unique<AudioAccessController>()
                                                                , std::make_unique<ArchivingController>()
                                                                , std::make_unique<ContentAccessController>()
                                                                , std::make_unique<ModelUpdateController>(*this)
                                                                , std::make_unique<PlaybackController>(playHead)
                                                                );
auto const allRoles = ARA::kARAPlaybackRendererRole | ARA::kARAEditorRendererRole | ARA::kARAEditorViewRole;
auto const docRef = documentController->getDocumentController().getRef();
auto const plugInExtensionInstance = juce::ARAHostModel::PlugInExtensionInstance{araProcessor->bindToARA(docRef, allRoles, allRoles)};
playbackRenderer = plugInExtensionInstance.getPlaybackRendererInterface();
editorRenderer = plugInExtensionInstance.getEditorRendererInterface();
musicalContext = std::make_unique<MusicalContext>(documentController->getDocumentController());
regionSequence = std::make_unique<RegionSequence>(documentController->getDocumentController(), *musicalContext.get(), "Track");