SoundEffect.Play Method (Microsoft.Xna.Framework.Audio)

Gets an internal SoundEffectInstance and plays it with the specified volume, pitch, and panning.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.1082)
  • C#
  • VB
  • F#
public bool Play(
	float volume, 
	float pitch, 
	float pan
)

Syntax for VB is not yet implemented.

Syntax for F# is not yet implemented.

Parameters

volume
Type: System.Single
Volume, ranging from 0.0 (silence) to 1.0 (full volume). Volume during playback is scaled by SoundEffect.MasterVolume.
pitch
Type: System.Single
Pitch adjustment, ranging from -1.0 (down an octave) to 0.0 (no change) to 1.0 (up an octave).
pan
Type: System.Single
Panning, ranging from -1.0 (left speaker) to 0.0 (centered), 1.0 (right speaker).

Return Value

Type: System.Boolean
True if a SoundEffectInstance was successfully created and played, false if not.
Play returns false if more SoundEffectInstances are currently playing then the platform allows.To apply looping or simulate 3D audio, call SoundEffect.CreateInstance() and SoundEffectInstance.Play() instead.SoundEffectInstances used by SoundEffect.Play() are pooled internally.
Supported in:

    
 Windows DirectX Desktop
    
 Linux Desktop
    
 Windows OpenGL Desktop
    
 Web