SoundEffect Class (Microsoft.Xna.Framework.Audio)
Represents a loaded sound resource.
Namespace: Microsoft.Xna.Framework.Audio
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.1082)
Assembly: MonoGame.Framework (MonoGame.Framework.dll 3.8.0.1082)
- C#
- VB
- F#
public sealed class SoundEffect : IDisposable
Syntax for VB is not yet implemented.
Syntax for F# is not yet implemented.
The SoundEffect type exposes the following members.
Platforms | Name | Description | |
---|---|---|---|
SoundEffect(Byte[], int, AudioChannels) | Create a sound effect. | ||
SoundEffect(Byte[], int, int, int, AudioChannels, int, int) | Create a sound effect. |
Platforms | Name | Description | |
---|---|---|---|
DistanceScale | Gets or sets the scale of distance calculations. | ||
DopplerScale | Gets or sets the scale of Doppler calculations applied to sounds. | ||
Duration | Gets the duration of the SoundEffect. | ||
IsDisposed | Indicates whether the object is disposed. | ||
MasterVolume | Gets or sets the master volume scale applied to all SoundEffectInstances. | ||
Name | Gets or sets the asset name of the SoundEffect. | ||
Speakers | |||
SpeedOfSound | Returns the speed of sound used when calculating the Doppler effect.. |
Platforms | Name | Description | |
---|---|---|---|
CreateInstance | Creates a new SoundEffectInstance for this SoundEffect. | ||
Dispose | Releases the resources held by this SoundEffect. (Implements IDisposable.Dispose().) | ||
Finalize | Releases unmanaged resources and performs other cleanup operations before the SoundEffect is reclaimed by garbage collection. (Overrides object.Finalize().) | ||
FromFile | Creates a new SoundEffect object based on the specified data stream. This internally calls FromStream(Stream). | ||
FromStream | Creates a new SoundEffect object based on the specified data stream. | ||
GetSampleDuration | Returns the duration for 16-bit PCM audio. | ||
GetSampleSizeInBytes | Returns the data size in bytes for 16bit PCM audio. | ||
Initialize | Initializes the sound system for SoundEffect support. This method is automatically called when a SoundEffect is loaded, a DynamicSoundEffectInstance is created, or Microphone.All is queried. You can however call this method manually (preferably in, or before the Game constructor) to catch any Exception that may occur during the sound system initialization (and act accordingly). | ||
Play() | Gets an internal SoundEffectInstance and plays it. | ||
Play(float, float, float) | Gets an internal SoundEffectInstance and plays it with the specified volume, pitch, and panning. |
Supported in:
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web
Windows DirectX Desktop
Linux Desktop
Windows OpenGL Desktop
Web