Microphone.GetData Method (Byte , Int32, Int32)

Gets the latest captured audio data from the microphone based on the specified offset and byte count.

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

Syntax

public int GetData (
         byte[] buffer,
         int offset,
         int count
)

Parameters

  • buffer
    Buffer, in bytes, containing the captured 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 desired audio data.

Return Value

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

Exceptions

Exception type Condition
ArgumentException

The exception thrown when the following arguments are invalid:

  • buffer is null, has zero length, or does not satisfy alignment requirements.
  • offset is less than zero, is greater than or equal to the size of the buffer, or does not satisfy alignment requirements.
  • The sum of count and offset is greater than the size of the buffer, count is less than or equal to zero, or does not satisfy alignment requirements.

Remarks

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