Category | Employs DSP | Employs DSP and responds to MIDI events |
---|---|---|
Audio creation | kAudioUnitType_Generator (Generator variant) | kAudioUnitType_MusicDevice (Instrument variant) |
Audio modification | kAudioUnitType_Effect (Effect variant) | kAudioUnitType_MusicEffect (Music Effect variant) |
AUViewController
class. (If you need to provide an Audio Unit app extension with no UI, subclass the NSObject
class instead.) The principal class for your extension must conform to the AUAudioUnitFactory
protocol.AUAudioUnit
subclass for the audio unit itself, an Info.plist
file, an AUViewController
subclass, and a MainInterface.storyboard
file. Info.plist
keys and values for an iOS Audio Unit app extension for the Effect variant. The type
key in this property list specifies the audio unit type that determines the variant, in this case with a value of aufx
. For explanations of all the available keys and values, see Table 6-2.<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>AudioComponents</key>
<array>
<dict>
<key>description</key>
<string>TremoloUnit</string>
<key>manufacturer</key>
<string>Aaud</string>
<key>name</key>
<string>Aaud: TremoloUnit</string>
<key>sandboxSafe</key>
<true/>
<key>subtype</key>
<string>tmlo</string>
<key>tags</key>
<array>
<string>Effects</string>
</array>
<key>type</key>
<string>aufx</string>
<key>version</key>
<integer>0001</integer>
</dict>
</array>
</dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.AudioUnit-UI</string>
</dict>
AUViewController
subclass with an NSObject
subclass.NSExtensionMainStoryboard
key with the NSExtensionPrincipalClass
key.Info.plist
file, described in Table 6-2. Key | Value description |
---|---|
description | A product name for the audio unit, such as TremoloUnit . |
manufacturer | A manufacturer code for the audio unit, such as Aaud . This value must be exactly 4 alphanumeric characters. |
name | The full name of the audio unit. This is derived from the manufacturer and description key values. |
sandboxSafe | (macOS only) A Boolean value indicating whether the audio unit can be loaded directly into a sandboxed process. For more information on sandboxing, see App Sandboxing. |
subtype | A subtype code for the audio unit, such as tmlo . This value must be exactly 4 alphanumeric characters. |
tags | An array of tags that describe the audio unit. The following predefined tags are already localized for your convenience: Bass , Delay , Distortion , Drums , Dynamics , Dynamics Processor , Effects , Equalizer , Filter , Format Converter , Guitar , Imaging , MIDI , Mixer , Offline Effect , Output , Panner , Pitch , Reverb , Sampler , Synthesizer , Time Effect , Vocal . Optionally, include additional tags that describe the extension in a meaningful way to your users. |
type | The specific variant of the Audio Unit app extension, as you choose it when setting up the Xcode template. The four possible types and their values are: Effect ( aufx ), Generator (augn ), Instrument (aumu ), and Music Effect (aufm ). |
version | A version number for the Audio Unit app extension, such as 0001 . |
NSExtensionMainStoryboard | The name of the main storyboard file for the Audio Unit app extension. This key is required unless you are specifically creating an Audio Unit app extension without a user interface. In that unusual case, use the NSExtensionPrincipalClass key instead. |
NSExtensionPointIdentifier | The extension point identifier for the Audio Unit app extension. This value is com.apple.AudioUnit-UI for a extension that has a user interface (the default and usual case), or com.apple.AudioUnit for one without a UI. |
preferredContentSize
property of the NSViewController
class to specify the Audio Unit app extension main view’s preferred size, based on the size of the selected content. (You can also specify minimum and maximum sizes for the extension’s view, to ensure that a host app doesn’t make unreasonable adjustments to the view.) To specify a preferred position for the app extension main view, set the preferredScreenOrigin
property to the lower-left corner of the extension’s view.AUViewController
subclass must attempt to connect its UI controls to its audio unit parameters when either the UI has been loaded or when the audio unit has been loaded, whichever happens first. Listing 6-2 shows code that attempts to connect the extension UI to its audio unit for both cases.@implementationAudioUnitViewController{
AUAudioUnit*audioUnit;
}
-(AUAudioUnit*)createAudioUnitWithComponentDescription:(AudioComponentDescription)descerror:(NSError**)error{
audioUnit=[[MyAudioUnitalloc]initWithComponentDescription:descerror:error];
// Check if the UI has been loaded
if(self.isViewLoaded){
[selfconnectUIToAudioUnit];
}
returnaudioUnit;
}
-(void)viewDidLoad{
[superviewDidLoad];
// Check if the Audio Unit has been loaded
if(audioUnit){
[selfconnectUIToAudioUnit];
}
}
-(void)connectUIToAudioUnit{
// Get the parameter tree and add observers for any parameters that the UI needs to keep in sync with the Audio Unit
}
@end
AUAudioUnit
subclass:inputBusses
getter method to return the app extension’s audio input connection points.outputBusses
getter method to return the app extension’s audio output connection points.internalRenderBlock
getter method to return the block that implements the app extension’s audio rendering loop.allocateRenderResourcesAndReturnError:
method, which the host app calls before it starts to render audio, and override the deallocateRenderResources
method, which the host app calls after it has finished rendering audio. Within each override, call the AUAudioUnit
superclass implementation.