Bagikan melalui


SoundBank.PlayCue Method

Plays a cue.

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

Syntax

public void PlayCue (
         string name
)

Parameters

  • name
    Name of the cue to play.

Exceptions

Exception type Condition
ArgumentNullException The name parameter is null.

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.

See Also

Tasks

How to: Play a Sound
How to: Stop or Pause a Sound

Reference

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

Platforms

Xbox 360, Windows XP SP2, Windows Vista