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.