Instance Method

attach(_:)

Attaches a new audio node to the audio engine.

Declaration

func attach(_ node: AVAudioNode)

Parameters

node

The audio node to be attached to the audio engine.

Discussion

To support the instantiation of arbitrary AVAudioNode subclasses, instances are created externally to the audio engine but are unusable until attached to the audio engine using this method. Thus the idiom is:

// when building engine:
AVAudioNode *_player;    // member of controller class (for example)
...
_player = [[AVAudioPlayerNode alloc] init];
[engine attachNode: _player];
...
// when destroying engine (without ARC)
[_player release];

See Also

Attaching and Detaching Audio Nodes

func detach(AVAudioNode)

Detaches an audio node previously attached to the audio engine.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software