SoundBank.GetCue Method
Gets a cue from the sound bank.
Syntax
'Declaration
Public Function GetCue ( _
name As String _
) As Cue
public Cue GetCue (
string name
)
public:
Cue GetCue(
String name
)
Parameters
- name
Type: String
Friendly name of the cue to get.
Return Value
Type: Cue
Cue object.
Exceptions
Exception type | Condition |
---|---|
ArgumentNullException | The name parameter is null. |
ArgumentException | The name parameter specifies a cue that does not exist. |
Remarks
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.
Requirements
Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Concepts
Reference
SoundBank Class
SoundBank Members
Microsoft.Xna.Framework.Audio Namespace
Platforms
Windows Phone