DynamicSoundEffectInstance

class DynamicSoundEffectInstance : SoundEffectInstance, System.IDisposable

A T:Microsoft.Xna.Framework.Audio.SoundEffectInstance for which the audio buffer is provided by the game at run time.

bool IsLooped

This value has no effect on DynamicSoundEffectInstance. It may not be set.

readonly SoundState State
readonly int PendingBufferCount

Returns the number of audio buffers queued for playback.

public void add_BufferNeeded(System.EventHandler<EventArgs> value)
Parameters:
  • value (System.EventHandler<EventArgs>) –
public void remove_BufferNeeded(System.EventHandler<EventArgs> value)
Parameters:
  • value (System.EventHandler<EventArgs>) –
public System.TimeSpan GetSampleDuration(int sizeInBytes)

Returns the duration of an audio buffer of the specified size, based on the settings of this instance.

Parameters:
  • sizeInBytes (int) – Size of the buffer, in bytes.
Returns:

The playback length of the buffer.

public int GetSampleSizeInBytes(System.TimeSpan duration)

Returns the size, in bytes, of a buffer of the specified duration, based on the settings of this instance.

Parameters:
  • duration (System.TimeSpan) – The playback length of the buffer.
Returns:

The data size of the buffer, in bytes.

public void Play()

Plays or resumes the DynamicSoundEffectInstance.

public void Pause()

Pauses playback of the DynamicSoundEffectInstance.

public void Resume()

Resumes playback of the DynamicSoundEffectInstance.

public void Stop()

Immediately stops playing the DynamicSoundEffectInstance.

public void Stop(bool immediate)

Stops playing the DynamicSoundEffectInstance. If the parameter is false, this call has no effect.

Parameters:
  • immediate (bool) – When set to false, this call has no effect.
public void SubmitBuffer(System.Byte[] buffer)

Queues an audio buffer for playback.

Parameters:
  • buffer (System.Byte[]) – The buffer containing PCM audio data.
public void SubmitBuffer(System.Byte[] buffer, int offset, int count)

Queues an audio buffer for playback.

Parameters:
  • buffer (System.Byte[]) – The buffer containing PCM audio data.
  • offset (int) – The starting position of audio data.
  • count (int) – The amount of bytes to use.
void UpdateQueue()