SoundEffect.GetSampleDuration Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns the sample duration based on the specified sample size and sample rate.
Namespace: Microsoft.Xna.Framework.Audio
Assembly: Microsoft.Xna.Framework (in Microsoft.Xna.Framework.dll)
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
)
Parameters
- sizeInBytes
Type: System.Int32
Size, in bytes, of audio data.
- sampleRate
Type: System.Int32
Sample rate, in Hertz (Hz), of audio content. The sampleRate must be between 8000 Hz and 48000 Hz.
- channels
Type: Microsoft.Xna.Framework.Audio.AudioChannels
Number of channels in the audio data.
Return Value
Type: System.TimeSpan
The calculated sample duration.
Version Information
Silverlight
Supported in: 5
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.