AUV3 hosting on iOS

Hi

I see that Juce version 4.2 added support for Audio Unit V3 on iOS. Does this also include hosting?

Yes, it does!

And, running the risk of you telling me to get off my backside and find out for myself, does it also provide the mechanism which allows the host app to render the pluginā€™s UI as if itā€™s ā€˜embeddedā€™ within the host?

Yep, thatā€™s right.

Brilliant, youā€™ve inspired me to give it a whirl but Iā€™ve run into a couple of build problems. This is what Iā€™ve done:

  • Got the latest Juce-master as a zip file from GitHub (this morning)
  • Built Projucer
  • Loaded the audio plugin host demo project and added an iOS target
  • Chose ā€˜save project and open in IDEā€™
  • Disabled VST plugin support by hacking AppConfig.h
  • In Xcode, started an iOS build for an iPad Air 2 target

There seem to be a couple of compilation errors in juce_audioUnitPluginFormat.mm due to the use of ā€˜NSViewControllerā€™. I went with Xcodeā€™s suggestion of changing them to ā€˜UIViewControllerā€™, which Iā€™ve no idea is appropriate but that got me to the linker, which seems to be unhappy about not being able to find the AudioUnit framework (full log below). Itā€™s strange, the framework seems to be there and if I look at its properties it seems to be the right one (ie. the one from iPhoneIS9.3.sdk). Iā€™ve tried removing/re-adding it in Xcode with clean builds in between but still the same problem.

Iā€™m on Xcode 7.3. Let me know if you want me to try anything ā€¦

Ld build/Debug/Plugin\ Host.app/Plugin\ Host normal arm64
    cd "/Users/Me/Desktop/JUCE-master/examples/audio plugin host/Builds/iOS"
    export IPHONEOS_DEPLOYMENT_TARGET=9.3
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -L/Users/mborstel/Desktop/JUCE-master/examples/audio\ plugin\ host/Builds/iOS/build/Debug -F/Users/mborstel/Desktop/JUCE-master/examples/audio\ plugin\ host/Builds/iOS/build/Debug -filelist /Users/mborstel/Desktop/JUCE-master/examples/audio\ plugin\ host/Builds/iOS/build/Plugin\ Host.build/Debug-iphoneos/Plugin\ Host\ (App).build/Objects-normal/arm64/Plugin\ Host.LinkFileList -miphoneos-version-min=9.3 -dead_strip -Xlinker -no_deduplicate -fembed-bitcode-marker -framework AudioUnit -framework Accelerate -framework AudioToolbox -framework AVFoundation -framework CoreAudio -framework CoreAudioKit -framework CoreGraphics -framework CoreMIDI -framework CoreText -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -Xlinker -dependency_info -Xlinker /Users/mborstel/Desktop/JUCE-master/examples/audio\ plugin\ host/Builds/iOS/build/Plugin\ Host.build/Debug-iphoneos/Plugin\ Host\ (App).build/Objects-normal/arm64/Plugin\ Host_dependency_info.dat -o /Users/mborstel/Desktop/JUCE-master/examples/audio\ plugin\ host/Builds/iOS/build/Debug/Plugin\ Host.app/Plugin\ Host

ld: framework not found AudioUnit
clang: error: linker command failed with exit code 1 (use -v to see invocation)

OK this is fixed on the develop branch. I just tried the ā€œaudio plugin hostā€ sample and was surprised that it actually works on our iPad mini 2 - albeit being nearly impossible to control with my fat fingers :-). I was able to hook up the JuceDemoPlugin :slight_smile:. See screenshot below:

2 Likes

was surprised that it works quite well

Yeah I think I still code for those moments of surprise. Like spending a week writing a new renderer before you can run it. Nine times out of ten youā€™ll just get a black screen if youā€™re lucky, but one time in ten itā€™ll pop into life first time - canā€™t beat that feeling!

Well done, Iā€™ll try it out!

2 Likes

Yep I can confirm it works. Some minor display issues with a (or should I say, one of the only) 3rd party plugins but as proof of concept it does the job admirably.

1 Like

FYI the layout issue is actually a bug in the Arturia plugin. In AUv3 the plugin is supposed to resize to fit the host, but theyā€™ve clearly hard-coded their layout to fit GarageBand, and are ignoring the size weā€™re giving it.

I seem to vaguely remember reading some early docs about AUs on iOS which suggested that they had to adhere to some quite specific dimensions. Although there again that may have been some web article based on what was being seen in Garage Band. Anyway, if resizing is possible that great news for those writing hosts - but possibly a headache for some plugin developers!

There is a new preferredSize call in AUv3 with which you can ask the plug-in for itā€™s ā€œpreferred sizeā€. We donā€™t have hosting support for that atm but it would be a good idea to add it.