Share via


SoundEffect.GetSampleSizeInBytes Method

Returns the size of the audio sample based on duration, sample rate, and audio channels.

Syntax

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

Parameters

  • duration
    Type: TimeSpan
    TimeSpan object that contains the sample duration.
  • sampleRate
    Type: Int32
    Sample rate, in Hertz (Hz), of audio content. The sampleRate parameter must be between 8,000 Hz and 48,000 Hz.
  • channels
    Type: AudioChannels
    Number of channels in the audio data.

Return Value

Type: Int32
Size, in bytes, of audio sample.

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