Type Method

playSoundFileNamed:waitForCompletion:

Creates an action that plays a sound.

Declaration

+ (SKAction *)playSoundFileNamed:(NSString *)soundFile waitForCompletion:(BOOL)wait;

Parameters

soundFile

The name of a sound file in the app’s bundle.

wait

If YES, the duration of this action is the same as the length of the audio playback. If NO, the action is considered to have completed immediately.

Return Value

A new action object.

Discussion

Use SKAction playSoundFileNamed:waitForCompletion: only for short incidentals. Use AVAudioPlayer for long running background music. This action is not reversible; the reversed action is identical to the original action.

See Also

Conrolling the Audio of a Node

+ play

Creates an action that tells an audio node to start playback.

+ pause

Creates an action that tells an audio node to pause playback.

+ stop

Creates an action that tells an audio node to stop playback.

+ changePlaybackRateTo:duration:

Creates an action that changes an audio node’s playback rate to a new value.

+ changePlaybackRateBy:duration:

Creates an action that changes an audio node’s playback rate by a relative amount.

+ changeVolumeTo:duration:

Creates an action that changes an audio node’s volume to a new value.

+ changeVolumeBy:duration:

Creates an action that changes an audio node’s volume by a relative value.

+ changeObstructionTo:duration:

Creates an action that changes an audio node’s obstruction to a new value.

+ changeObstructionBy:duration:

Creates an action that changes an audio node’s obstruction by a relative value.

+ changeOcclusionTo:duration:

Creates an action that changes an audio node’s occlusion to a new value.

+ changeOcclusionBy:duration:

Creates an action that changes an audio node’s occlusion by a relative value.

+ changeReverbTo:duration:

Creates an action that changes an audio node’s reverb to a new value.

+ changeReverbBy:duration:

Creates an action that changes an audio node’s reverb by a relative value.

+ stereoPanTo:duration:

Creates an action that changes an audio node’s stereo panning to a new value.

+ stereoPanBy:duration:

Creates an action that changes an audio node’s stereo panning by a relative value.