SoundEffect Constructor (Byte , Int32, Int32, Int32, AudioChannels, Int32, Int32)
Initializes a new instance of SoundEffect with specified parameters such as audio sample rate, channels, looping criteria, and a buffer to hold the audio.
Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
Syntax
public SoundEffect (
byte[] buffer,
int offset,
int count,
int sampleRate,
AudioChannels channels,
int loopStart,
int loopLength
)
Parameters
- buffer
Buffer that contains the audio data. The audio format must be PCM wave data. - offset
Offset, in bytes, to the starting position of the audio data. - count
Amount, in bytes, of audio data. - sampleRate
Sample rate, in Hertz (Hz), of audio data. - channels
Number of channels (mono or stereo) of audio data. - loopStart
Loop start in samples. - loopLength
Loop length in samples.
Exceptions
Exception type | Condition |
---|---|
ArgumentOutOfRangeException | The exception thrown when the following arguments are out of range:
|
ArgumentException | The exception thrown when the following arguments are invalid:
|
Remarks
For information regarding audio format using XNA Game Studio see Audio API Developers Guide.
See Also
Concepts
Sounds Overview
Audio API Developers Guide
Reference
SoundEffect Class
SoundEffect Members
Microsoft.Xna.Framework.Audio Namespace
Platforms
Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone 7