SoundEffect.Play Method (Single, Single, Single)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Plays a sound based on specified volume, pitch, and panning.

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

Syntax

'Declaration
Public Function Play ( _
    volume As Single, _
    pitch As Single, _
    pan As Single _
) As Boolean
public bool Play(
    float volume,
    float pitch,
    float pan
)

Parameters

  • volume
    Type: System.Single
    Volume, ranging from 0.0f (silence) to 1.0f (full volume). 1.0f is full volume relative to MasterVolume.
  • pitch
    Type: System.Single
    Pitch adjustment, ranging from -1.0f (down one octave) to 1.0f (up one octave). 0.0f is unity (normal) pitch.
  • pan
    Type: System.Single
    Panning, ranging from -1.0f (full left) to 1.0f (full right). 0.0f is centered.

Return Value

Type: System.Boolean
true if the sound is playing back successfully; otherwise, false.

Version Information

Silverlight

Supported in: 5

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.