Bagikan melalui


SoundBank.PlayCue Method (String)

Plays a cue.

Syntax

'Declaration
Public Sub PlayCue ( _
         name As String _
)
public void PlayCue (
         string name
)
public:
void PlayCue(
         String name
)

Parameters

  • name
    Type: String
    Name of the cue to play.

Exceptions

Exception type Condition
ArgumentNullException The name parameter is null.
InvalidOperationException The name parameter specifies a cue that does not exist.

Remarks

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

Calling this method does not return a Cue object. Therefore, once the cue has started playing, it cannot be controlled through any methods of Cue, such as Stop, Pause, or Resume. The cue will play until its authored end, at which point it will be released.

Because no Cue object is retrieved, cues played using this method are also unable to use Apply3D to apply 3D effects to the cue. To retrieve a cue that you can control during playback, or apply 3D effects to, use GetCue.

Cue objects whose Playlist Type property has been specified as Interactive cannot be initiated with the PlayCue method. (This property is set in the XACT tool, within the Variation Playlist attributes of the Cue Properties.) Instead, retrieve the Cue object with the GetCue method, invoke its Play method, then release the object through the Dispose method.

Requirements

Namespace: Microsoft.Xna.Framework.Audio

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

See Also

Reference

SoundBank.PlayCue Method
SoundBank Class
SoundBank Members
Microsoft.Xna.Framework.Audio Namespace

Platforms

Windows Phone