Export (0) Print
Expand All

SoundBank.GetCue Method

Gets a cue from the sound bank.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public Cue GetCue (
         string name
)

Parameters

name
Friendly name of the cue to get.

Return Value

Cue object.

Exception typeCondition
ArgumentNullException The name parameter is null.

Each Cue instance that you retrieve is unique, even when retrieving multiple cues with the same name. This allows multiple instances of the same Cue to exist and play simultaneously.

The Cue instance that you retrieve using this method is valid only as long as it is in scope. If the Cue instance is allowed to go out of scope, such as in the case of the Cue being retrieved and played without otherwise being stored, the Cue is marked to be disposed by the garbage collector. This will result in the Cue stopping playback at an indeterminate time when the garbage collector disposes of the Cue. To prevent this behavior, store Cue objects to prevent them from falling out of scope. Alternatively, you can call PlayCue to play a cue immediately that will not fall out of scope.

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions

ADD
Show:
© 2014 Microsoft