SoundEffect.GetSampleDuration Method

Returns the sample duration based on the specified sample size and sample rate.

Syntax

'Declaration
Public Shared Function GetSampleDuration ( _
         sizeInBytes As Integer, _
         sampleRate As Integer, _
         channels As AudioChannels _
) As TimeSpan 
public static TimeSpan GetSampleDuration (
         int sizeInBytes,
         int sampleRate,
         AudioChannels channels
)
public:
static TimeSpan GetSampleDuration(
         int sizeInBytes,
         int sampleRate,
         AudioChannels channels
)

Parameters

  • sizeInBytes
    Type: Int32
    Size, in bytes, of audio data.
  • sampleRate
    Type: Int32
    Sample rate, in Hertz (Hz), of audio content. The sampleRate must be between 8000 Hz and 48000 Hz.
  • channels
    Type: AudioChannels
    Number of channels in the audio data.

Return Value

Type: TimeSpan
TimeSpan object that represents the calculated sample duration.

Requirements

Namespace: Microsoft.Xna.Framework.Audio

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

See Also

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

Platforms

Windows Phone