Share via


DynamicSoundEffectInstance.SubmitBuffer Method (Byte )

Submits an audio buffer for playback. Playback starts at the beginning, and the buffer is played in its entirety.

Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public void SubmitBuffer (
         byte[] buffer
)

Parameters

  • buffer
    Buffer that contains the audio data. The audio format must be PCM wave data.

Remarks

The buffer must conform to the format alignment. For example, the buffer length must be aligned to the block alignment value for the audio format type. For PCM audio format, the block alignment is calculated as BlockAlignment = BytesPerSample * AudioChannels. DynamicSoundEffectInstance supports only PCM 16-bit mono or stereo data. Therefore, BlockAlignment = 2 * AudioChannels (Channels is 2 for mono content and 4 for stereo).

For information about an audio format using XNA Game Studio, see Audio API Developers Guide.

Silverlight applications must ensure that FrameworkDispatcher.Update is called regularly in order for "fire and forget" sounds to work correctly. SubmitBuffer throws an InvalidOperationException if FrameworkDispatcher.Update has not been called at least once before making this call. For more information, see Enable XNA Framework Events in Windows Phone Applications.

See Also

Concepts

Sounds Overview
Audio API Developers Guide

Reference

--> DynamicSoundEffectInstance Class
DynamicSoundEffectInstance Members
Microsoft.Xna.Framework.Audio Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP, Windows Phone 7