ABFilterPort Class Reference

Filter port. More...

#import <ABFilterPort.h>

Inherits ABPort, and <ABLocalPort>.

Instance Methods

(id) - initWithName:title:audioComponentDescription:processBlock:processBlockSize:
 Initialize.
 
(id) - initWithName:title:audioComponentDescription:audioUnit:
 Initialize.
 
(void) - registerAdditionalAudioComponentDescription:
 Register additional AudioComponentDescriptions that identify your audio unit.
 
(BOOL) - ABFilterPortIsConnected
 Determine if the filter port is currently connected.
 

Properties

AudioUnit audioUnit
 Audio unit.
 
AudioStreamBasicDescription clientFormat
 Client format.
 
NSArray * sources
 Currently-connected sources.
 
NSArray * destinations
 Currently-connected destinations.
 
BOOL connected
 Whether the port is connected (via IAA or Audiobus)
 
BOOL interAppAudioConnected
 Whether the port is connected via Inter-App Audio.
 
BOOL audiobusConnected
 Whether the port is connected via Audiobus.
 
AudioComponentDescription audioComponentDescription
 The AudioComponentDescription, of type kAudioUnitType_RemoteEffect or kAudioUnitType_RemoteMusicEffect, which identifies this port's published audio unit.
 
NSString * title
 The title of the port, for display to the user.
 
UIImage * icon
 The port icon (a 32x32 image)
 
UInt32 latency
 The constant latency of this filter, in frames.
 
BOOL bypassed
 Whether the port is bypassed.
 
- Properties inherited from ABPort
ABPeerpeer
 The peer this port is on.
 
NSString * name
 The internal port name.
 
NSString * title
 The title of the port, for display to the user.
 
UIImage * icon
 The port icon (a 64x64 image)
 
ABPortType type
 The type of the port.
 
uint8_t attributes
 The attributes of this port.
 

Detailed Description

Filter port.

This class is used to filter audio.

See the integration guide's section on using the Filter Port for discussion.

Method Documentation

- (id) initWithName: (NSString *)  name
title: (NSString *)  title
audioComponentDescription: (AudioComponentDescription)  description
processBlock: (ABAudioFilterBlock processBlock
processBlockSize: (UInt32)  processBlockSize 

Initialize.

Initializes a new filter port, with a block to use for filtering

Parameters
nameThe name of the filter port, for internal use
titleTitle of port, show to the user
descriptionThe AudioComponentDescription that identifiers this port. This must match the entry in the AudioComponents dictionary of your Info.plist, and must be of type kAudioUnitType_RemoteEffect or kAudioUnitType_RemoteMusicEffect.
processBlockA block to use to process audio as it arrives at the filter port
processBlockSizeSpecify the number of frames you want to process each time the filter block is called. Audiobus will automatically queue up frames until this number is reached, then call the audio block for this number of frames. Set to 0 if this value is unimportant, and Audiobus will use whatever number of frames results in the least latency.
- (id) initWithName: (NSString *)  name
title: (NSString *)  title
audioComponentDescription: (AudioComponentDescription)  description
audioUnit: (AudioUnit)  audioUnit 

Initialize.

Initializes a new filter port, with an audio unit for filtering

Note: The audio unit you pass here must be an output unit (kAudioUnitSubType_RemoteIO). If you wish to use a different kind of audio unit, you'll need to use the process block initialiser and call AudioUnitRender on the audio unit yourself from within the process block, while feeding its input via a callback that passes in the audio given to you in the process block.

Parameters
nameThe name of the filter port, for internal use
titleTitle of port, show to the user
descriptionThe AudioComponentDescription that identifiers this port. This must match the entry in the AudioComponents dictionary of your Info.plist, and must be of type kAudioUnitType_RemoteEffect or kAudioUnitType_RemoteMusicEffect.
audioUnitThe output audio unit to use for processing. The audio unit's input will be replaced with the audio to process.
- (void) registerAdditionalAudioComponentDescription: (AudioComponentDescription)  description

Register additional AudioComponentDescriptions that identify your audio unit.

Sometimes under Inter-App Audio you may wish to publish your audio unit with an additional AudioComponentDescription, such as providing both kAudioUnitType_RemoteEffect and kAudioUnitType_RemoteMusicEffect types.

If you wish to do so, you can use this method to register the additional descriptions (additional to the one passed via the init method). Note that this method will not publish your audio unit with the given description: you'll need to do that yourself.

This will cause the port to correctly recognize incoming connections from the other descriptions.

Parameters
descriptionThe additional AudioComponentDescription to add
- (BOOL) ABFilterPortIsConnected (ABFilterPort *)  filterPort

Determine if the filter port is currently connected.

If you are using the processBlock initializer, then you must mute your app's main audio output when this function returns YES.

This function is suitable for use from within a realtime Core Audio context.

Parameters
filterPortThe filter port.
Returns
YES the filter port is currently connected; NO otherwise.

Property Documentation

- (AudioUnit) audioUnit
readwritenonatomicassign

Audio unit.

The audio unit to use for processing. If you uninitialize the audio unit passed to this class's initializer, be sure to set this property to NULL immediately beforehand.

If you did not provide an audio unit when initializing the port, this property will allow you to gain access to the internal audio unit used for audio transport, for the purposes of custom Inter-App Audio interactions such as transport control or MIDI exchange.

- (AudioStreamBasicDescription) clientFormat
readwritenonatomicassign

Client format.

If you're using a process block for processing, use this to specify what audio format to use. Audio will be automatically converted to and from the Audiobus line format.

The default value is non-interleaved stereo floating-point PCM.

- (NSArray*) sources
readnonatomicstrong

Currently-connected sources.

This is an array of ABPorts .

- (NSArray*) destinations
readnonatomicstrong

Currently-connected destinations.

This is an array of ABPorts .

- (BOOL) connected
readnonatomicassign

Whether the port is connected (via IAA or Audiobus)

- (BOOL) interAppAudioConnected
readnonatomicassign

Whether the port is connected via Inter-App Audio.

Note that this property will also return YES when connected to Audiobus peers using the 2.1 SDK.

- (BOOL) audiobusConnected
readnonatomicassign

Whether the port is connected via Audiobus.

- (AudioComponentDescription) audioComponentDescription
readnonatomicassign

The AudioComponentDescription, of type kAudioUnitType_RemoteEffect or kAudioUnitType_RemoteMusicEffect, which identifies this port's published audio unit.

- (NSString*) title
readwritenonatomicstrong

The title of the port, for display to the user.

- (UIImage*) icon
readwritenonatomicstrong

The port icon (a 32x32 image)

This is optional if your app only has one filter port, but if your app defines multiple filter ports, it is highly recommended that you provide icons for each, for easy identification by the user.

- (UInt32) latency
readwritenonatomicassign

The constant latency of this filter, in frames.

If your filter code adds a constant amount of latency to the audio stream (such as an FFT or lookahead operation), you should specify that here in order to have Audiobus automatically account for it.

This is important when users have the same input signal going through different paths, so that Audiobus can synchronize these properly at the output. If you don't specify the correct latency, the user will hear phasing due to incorrectly aligned signals at the output.

Default: 0

- (BOOL) bypassed
readwritenonatomicassign

Whether the port is bypassed.

This property value is automatically managed by an in-built trigger that appears to users from within the Connection Panel. If your filter app also provides its own bypass controls, you can use this property to keep the state of the built-in bypass feature and your app's own bypass feature synchronized.


The documentation for this class was generated from the following file: