Microphone.GetData Method (Byte , Int32, Int32)

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

Syntax

'Declaration
Public Function GetData ( _
         buffer As Byte(), _
         offset As Integer, _
         count As Integer _
) As Integer 
public int GetData (
         byte[] buffer,
         int offset,
         int count
)
public:
int GetData(
         unsigned char buffer[],
         int offset,
         int count
)

Parameters

  • buffer
    Type: Byte
    Buffer, in bytes, containing the captured audio data. The audio format must be PCM wave data.
  • offset
    Type: Int32
    Offset, in bytes, to the starting position of the data.
  • count
    Type: Int32
    Amount, in bytes, of desired audio data.

Return Value

Type: Int32
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.

Requirements

Namespace: Microsoft.Xna.Framework.Audio

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

See Also

Concepts

Working with Microphones
Sounds Overview
Audio API Developers Guide

Reference

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

Platforms

Windows Phone