Skip to content

bradhowes/auv3-support

Repository files navigation

CI COV License: MIT

Overview

Swift package containing useful code for AUv3 app extensions. There are three products in this package:

  • AUv3Shared -- collection of extensions and classes for both AudioUnit components packaged as an AUv3 app extension, and the host app that contains them. Because it will be linked to the AUv3 app extension, it must not link to or use any APIs that are forbidden by Apple for use by app extensions. This code works on both iOS and macOS platforms.
  • AUv3Host -- classes that provide a simple AUv3 hosting environment for the AUv3 app extension. Provides an audio chain that sends a sample loop through the AUv3 audio unit and out to the main speaker. The host supports user presets.
  • AUv3Component -- classes specific to an AUv3 component. Foremost is the FilterAudioUnit class that provides a generic AUv3 container for a custom DSP kernel that performs the signal processing. Additional Swift types provide useful parameter functionality.

Additional AUv3 functionality specific to C++ can be found in the DSPHeaders repo. Of particular note is the EventProcessor template class that provides a complete foundation for a C++ DSP kernel that can be used in Swift and put in FilterAudioUnit container.

Demo App

There is a demo app that illustrates how to use the AUv3Host and AUv3Component modules. The demo app essentially replicates what is available in Xcode when you ask it to create a new project from the "Audio Unit Extension App" template. The app serves as a simple AUv3 host to play audio samples through the AUv3 effect which is just a simple gain control. There is a circular knob that controls the gain of the effect. The knob comes from my AUv3Controls package, and it is served from the AUv3 component's SwiftUI view.

The "play" button starts/stops audio. The button next to it is the bypass that controls whether the effect affects the audio output. The last control provides quick access to the "factory" presets. This control attempts to mimic Apple's own segmented control but supports accented coloring (see the repo for details).

Below these controls there is text showing the name of the current preset. Touching that reveals a menu showing all known presets as well as controls for managing user presets. You can create your own presets, update them with new values, rename them, and delete them.

The last control is at the lower-right of the screen showing the version of the AUv3 application extension. When touched, the default behavior is to show the App Store entry for the AUv3 component.

History

This is an update of my AUv3Support package which used UIKit and AppKit and included the DSPHeaders package. This new package relies on SwiftUI and the hosting app is much more modularized using The Composable Architecture framework.

Otherwise, the functionality remains pretty much the same between the two packages.

About

Reworking of AUv3Support package for AUv3 and SwiftUI

Resources

License

Stars

Watchers

Forks

Packages

No packages published