Skip to content

Another template for a hosting app and a working AUv3 with SwiftUI interfaces

License

Notifications You must be signed in to change notification settings

bradhowes/AUv3Template-SwiftUI

Repository files navigation

CI AUv3 License: MIT

About AUv3Template2

This is full-featured AUv3 effect template for both iOS and macOS platforms. When configured, it will build an app for macOS and iOS platforms and embed in the app bundle an app extension containing the AUv3 component. The apps are designed to load the AUv3 component the same way as a host such as GarageBand would. It uses the extension to demonstrate how it works by playing a sample audio file and routing it through the effect and out to the device's speaker. The host app also supports user and factory presets. User presets can be created, updated, renamed and deleted. Factory presets can only be activated.

Additional features and info:

  • Uses a C++ kernel to generate audio samples in the render thread
  • Relies on Swift-C++ interoperability for access to the kernel from Swift code
  • Uses SwiftUI for all user interfaces

Also see my older version AUv3Template that uses UIKit and AppKit for UI rendering.

Host Controls

The controls at the top come from the AUv3Host package as part of the host application infrastructure it provides. There, you find:

  • play button to start/stop audio playing through the filter
  • bypass button to disable the filter
  • presets bar to quickly choose from a factory preset from the AUv3 extension
  • presets menu to show a menu of user and factory presets

The hosting app supports creating and managing user presets for the extension. These should operate in the same way that they do in other hosting apps such as GarageBand, Logic, Cubasis, AUM. When a user preset is active, you can then:

  • Update the preset by saving the current parameter settings under its name
  • Rename the preset to give it a new name
  • Delete the preset to remove it from the device

Swift 6

The code was originally developed in Xcode 12.4 on macOS 11.2.1 but the latest version now requires Swift 6. There are currently no known concurrency warnings or errors in the code.

Apps from the template have tested on both macOS and iOS devices, primarily in GarageBand but also using test hosts on both devices as well as the excellent AUM app on iOS.

Finally, it passes all auval tests:

% auval -v aufx flng BRay

Here flng is the unique component subtype for my SimplyFlange effect and BRay is my own manufacturer ID. You should use your own values that you put in Config.xcconfig.

Generating a New AUv3 Project

Note that this repo is a template, and as such it may not successfully run when compiled. The best bet is to use the Python3 build.py script to create a new project from the template. To do so, fire up a terminal shell and go into the AUV3Template directory. The script takes two arguments:

  • the name of the new project
  • the 4-character subtype of the effect

You would run it like this:

% python3 scripts/build.py MyEffect subtype

The name value should be self-evident in purpose: it will be the name of your iOS and macOS app, and the basis for the name of your app extensions. The subtype is a unique 4-character identifier for your new effect. It should be unique at least for your manufacturer space (see Config.xcconfig) so that it will not conflict with another app extension.

With a project name called "MyEffect", the Python3 script will creates new folder called MyEffect that is a sibling to the AUv3Template2 folder. The script will populate the new folder with the files from this template. Afterwards you should have a buildable and working AUv3 effect embedded in a demo app for iOS and macOS. All files with __NAME__ in them will be replaced with the first argument given to build.py (e.g. "MyEffect"), and all text files will be changed so that the strings __NAME__ and __SUBTYPE__ are replaced with their respective substitutions that you provided.

Note that to successfully compile you will need to edit Config.xcconfig and change the DEVELOPMENT_TEAM setting to hold your own Apple developer account ID so that Xcode can sign the binaries it creates. You should also adjust other settings as well to properly identify you and/or your company. The values to change should be clear.

⚠️ You are free to use the code according to LICENSE.md, but you must not replicate someone's UI, icons, samples, or any other assets if you are going to distribute your effect on the App Store.

Dependencies

This code currently depends on three other Swift packages:

About

Another template for a hosting app and a working AUv3 with SwiftUI interfaces

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published