public final class DynamicSoundEffectInstance extends SoundEffectInstance
Modifier and Type | Field and Description |
---|---|
Event<EventArgs> |
BufferNeeded
Event that occurs when the number of audio capture buffers awaiting playback is less than or equal to two.
|
IsLooped
Constructor and Description |
---|
DynamicSoundEffectInstance(int sampleRate,
AudioChannels channels)
Initializes a new instance of this class, which creates a dynamic sound effect based on the specified sample rate and audio channel.
|
Modifier and Type | Method and Description |
---|---|
protected void |
Dispose(boolean disposing)
Releases the unmanaged resources held by this SoundEffectInstance, and optionally releases the managed resources.
|
TimeSpan |
GetSampleDuration(int sizeInBytes)
Returns the sample duration based on the specified size of the audio buffer.
|
int |
GetSampleSizeInBytes(TimeSpan duration)
Returns the size of the audio buffer required to contain audio samples based on the specified duration.
|
void |
Play()
Begins or resumes audio playback.
|
void |
SubmitBuffer(byte[] buffer)
Submits an audio buffer for playback.
|
void |
SubmitBuffer(byte[] buffer,
int offset,
int count)
Submits an audio buffer for playback.
|
public DynamicSoundEffectInstance(int sampleRate, AudioChannels channels)
sampleRate
- Sample rate, in Hertz (Hz), of audio content.channels
- Number of channels in the audio data.ArgumentOutOfRangeException
protected void Dispose(boolean disposing)
SoundEffectInstance
Dispose
in class SoundEffectInstance
disposing
- Pass true to release both the managed and unmanaged resources for this SoundEffectInstance. Passing false releases only the unmanaged resources.public TimeSpan GetSampleDuration(int sizeInBytes)
sizeInBytes
- Size, in bytes, of the audio data.ObjectDisposedException
ArgumentException
public int GetSampleSizeInBytes(TimeSpan duration)
duration
- TimeSpan object that contains the duration of the audio sample.ObjectDisposedException
System.ArgumentOutOfException
public void Play()
Play
in class SoundEffectInstance
ObjectDisposedException
public void SubmitBuffer(byte[] buffer)
buffer
- Buffer that contains the audio data. The audio format must be PCM wave data.public void SubmitBuffer(byte[] buffer, int offset, int count)
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 data.count
- Amount, in bytes, of data sent.ObjectDisposedException
ArgumentException