Table of Contents

Class Cue

Namespace
Microsoft.Xna.Framework.Audio
Assembly
MonoGame.Framework.dll

Manages the playback of a sound or set of sounds.

public class Cue : IDisposable
Inheritance
Cue
Implements
Inherited Members

Remarks

Cues are comprised of one or more sounds.

Cues also define specific properties such as pitch or volume.

Cues are referenced through SoundBank objects.

Properties

IsCreated

Returns whether the cue has been created.

public bool IsCreated { get; }

Property Value

bool

Remarks

Current implementation will always return false.

IsDisposed

Is true if the Cue has been disposed.

public bool IsDisposed { get; }

Property Value

bool

IsPaused

Indicates whether or not the cue is currently paused.

public bool IsPaused { get; }

Property Value

bool

Remarks

IsPlaying and IsPaused both return true if a cue is paused while playing.

IsPlaying

Indicates whether or not the cue is currently playing.

public bool IsPlaying { get; }

Property Value

bool

Remarks

IsPlaying and IsPaused both return true if a cue is paused while playing.

IsPrepared

Returns whether the cue is prepared to play.

public bool IsPrepared { get; }

Property Value

bool

Remarks

This property returns true only if the cue is prepared but has not yet been played. Cues that are played return true for IsPlaying if they are currently playing or true for IsStopped if they are stopped.

IsPreparing

Returns whether the cue is preparing to play.

public bool IsPreparing { get; }

Property Value

bool

Remarks

Current implementation will always return false.

IsStopped

Indicates whether or not the cue is currently stopped.

public bool IsStopped { get; }

Property Value

bool

IsStopping

Returns whether the cue is stopping playback.

public bool IsStopping { get; }

Property Value

bool

Remarks

Current implementation will always return false.

Name

Gets the friendly name of the cue.

public string Name { get; }

Property Value

string

Remarks

The friendly name is a value set from the designer.

Methods

Apply3D(AudioListener, AudioEmitter)

Updates the simulated 3D Audio settings calculated between an AudioEmitter and AudioListener.

public void Apply3D(AudioListener listener, AudioEmitter emitter)

Parameters

listener AudioListener

The listener to calculate.

emitter AudioEmitter

The emitter to calculate.

Remarks

This must be called before Play().

Calling this method automatically converts the sound to monoaural and sets the speaker mix for any sound played by this cue to a value calculated with the listener's and emitter's positions. Any stereo information in the sound will be discarded.

Dispose()

Disposes the Cue.

public void Dispose()

GetVariable(string)

Gets a cue-instance variable value based on its friendly name.

public float GetVariable(string name)

Parameters

name string

Friendly name of the variable.

Returns

float

Value of the variable.

Remarks

Cue-instance variables are useful when multiple instantiations of a single cue (and its associated sounds) are required (for example, a "car" cue where there may be more than one car at any given time). While a global variable allows multiple audio elements to be controlled in unison, a cue instance variable grants discrete control of each instance of a cue, even for each copy of the same cue.

The friendly name is a value set from the designer.

Pause()

Pauses playback.

public void Pause()

Play()

Requests playback of a prepared or preparing Cue.

public void Play()

Remarks

Calling Play when the Cue already is playing can result in an InvalidOperationException.

Resume()

Resumes playback of a paused Cue.

public void Resume()

SetVariable(string, float)

Sets the value of a cue-instance variable based on its friendly name.

public void SetVariable(string name, float value)

Parameters

name string

Friendly name of the variable to set.

value float

Value to assign to the variable.

Remarks

The friendly name is a value set from the designer.

Stop(AudioStopOptions)

Stops playback of a Cue.

public void Stop(AudioStopOptions options)

Parameters

options AudioStopOptions

Specifies if the sound should play any pending release phases or transitions before stopping.

Events

Disposing

This event is triggered when the Cue is disposed.

public event EventHandler<EventArgs> Disposing

Event Type

EventHandler<EventArgs>