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.
Syntax
'Declaration
Public Sub New ( _
buffer As Byte(), _
offset As Integer, _
count As Integer, _
sampleRate As Integer, _
channels As AudioChannels, _
loopStart As Integer, _
loopLength As Integer _
)
public SoundEffect (
byte[] buffer,
int offset,
int count,
int sampleRate,
AudioChannels channels,
int loopStart,
int loopLength
)
public:
SoundEffect(
unsigned char buffer[],
int offset,
int count,
int sampleRate,
AudioChannels channels,
int loopStart,
int loopLength
)
Parameters
- buffer
Type: Byte
Buffer that contains the audio data. The audio format must be PCM wave data. - offset
Type: Int32
Offset, in bytes, to the starting position of the audio data. - count
Type: Int32
Amount, in bytes, of audio data. - sampleRate
Type: Int32
Sample rate, in Hertz (Hz), of audio data. - channels
Type: AudioChannels
Number of channels (mono or stereo) of audio data. - loopStart
Type: Int32
Loop start in samples. - loopLength
Type: Int32
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.
Requirements
Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
See Also
Concepts
Sounds Overview
Audio API Developers Guide
Reference
SoundEffect Class
SoundEffect Members
Microsoft.Xna.Framework.Audio Namespace
Platforms
Windows Phone