GetSampleDuration() public static method

Gets the TimeSpan representation of a single sample.
public static GetSampleDuration ( int sizeInBytes, int sampleRate, AudioChannels channels ) : TimeSpan
sizeInBytes int Size, in bytes, of audio data.
sampleRate int Sample rate, in Hertz (Hz). Must be between 8000 Hz and 48000 Hz
channels AudioChannels Number of channels in the audio data.
return TimeSpan
Ejemplo n.º 1
0
 public TimeSpan GetSampleDuration(int sizeInBytes)
 {
     return(SoundEffect.GetSampleDuration(
                sizeInBytes,
                sampleRate,
                channels
                ));
 }
Ejemplo n.º 2
0
 public TimeSpan GetSampleDuration(int sizeInBytes)
 {
     return(SoundEffect.GetSampleDuration(
                sizeInBytes,
                SampleRate,
                AudioChannels.Mono
                ));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns the duration based on the size of the buffer (assuming 16-bit PCM data).
 /// </summary>
 /// <param name="sizeInBytes">Size, in bytes</param>
 /// <returns>TimeSpan of the duration.</returns>
 public TimeSpan GetSampleDuration(int sizeInBytes)
 {
     // this should be 10ms aligned
     // this assumes 16bit mono data
     return(SoundEffect.GetSampleDuration(sizeInBytes, _sampleRate, AudioChannels.Mono));
 }
 /// <summary>
 /// Returns the duration of an audio buffer of the specified size, based on the settings of this instance.
 /// </summary>
 /// <param name="sizeInBytes">Size of the buffer, in bytes.</param>
 /// <returns>The playback length of the buffer.</returns>
 public TimeSpan GetSampleDuration(int sizeInBytes)
 {
     AssertNotDisposed();
     return(SoundEffect.GetSampleDuration(sizeInBytes, _sampleRate, _channels));
 }