Partager via


Microphone.BufferDuration Property

Gets or sets audio capture buffer duration of the microphone.

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

Syntax

public TimeSpan BufferDuration { get; set; }

Property Value

The duration of the audio capture buffer.

Exceptions

Exception type Condition
ArgumentOutOfRangeException The exception that is thrown if BufferDuration is less than 100 milliseconds or is greater than 1000 milliseconds.
ArgumentOutOfRangeException The exception that is thrown if BufferDuration is not aligned by 10 milliseconds.

Remarks

The duration of the capture buffer must be between 100ms and 1000ms. Additionally, the capture buffer must be 10ms aligned (BufferDuration % 10 == 0).

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

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

Platforms

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