Microphone.GetData Method (Byte )

Gets the latest recorded data from the microphone based on the audio capture buffer.

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

Syntax

public int GetData (
         byte[] buffer
)

Parameters

  • buffer
    Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.

Return Value

The buffer size, in bytes, of the audio data.

Exceptions

Exception type Condition
ArgumentException buffer is null, has zero length, or does not satisfy alignment requirements.

Remarks

Silverlight applications must ensure that FrameworkDispatcher.Update is called regularly in order for "fire and forget" sounds to work correctly. GetData 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.

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

See Also

Concepts

Working with Microphones
Sounds Overview
Audio API Developers Guide

Reference

Microphone Class
Microphone Members
Microsoft.Xna.Framework.Audio Namespace

Platforms

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