Type Method

audioPlayerWithAVAudioNode:

Returns an audio player (creating one if necessary) to play an audio node.

Declaration

+ (instancetype)audioPlayerWithAVAudioNode:(AVAudioNode *)audioNode;

Parameters

audioNode

An audio node object.

Return Value

A positional audio player object.

Discussion

Creating an audio player from an audio node does not attach that node to an AVAudioEngine object for mixing and playback—instead, this option allows you to build your own audio node graph for custom effects before manually adding it to the audioEngine object of the view (or other SceneKit renderer) displaying the scene. Then, after you attach the audio player to an SCNNode object, SceneKit continually updates the audio node’s 3D mixing parameters to match the position of the scene node.

When you use this method, SceneKit creates an audio player for the specified AVAudioNode object or, if an audio player for that node already exists and is not in use, SceneKit reuses the existing player object.

See Also

Creating an Audio Player

- initWithSource:

Initializes an audio player for playing the specified simple audio source.

- initWithAVAudioNode:

Initializes an audio player for playing the specified AVFoundation audio node.

+ audioPlayerWithSource:

Returns an audio player (creating one if necessary) to play a simple audio source.