public static GetSampleSizeInBytes ( TimeSpan duration, int sampleRate, AudioChannels channels ) : int | ||
duration | TimeSpan | TimeSpan object that contains the sample duration. |
sampleRate | int | Sample rate, in Hertz (Hz), of audio data. Must be between 8,000 and 48,000 Hz. |
channels | AudioChannels | Number of channels in the audio data. |
return | int |
public int GetSampleSizeInBytes(TimeSpan duration) { return(SoundEffect.GetSampleSizeInBytes( duration, sampleRate, channels )); }
public int GetSampleSizeInBytes(TimeSpan duration) { return(SoundEffect.GetSampleSizeInBytes( duration, SampleRate, AudioChannels.Mono )); }
/// <summary> /// Returns the size, in bytes, of the array required to hold the specified duration of 16-bit PCM data. /// </summary> /// <param name="duration">TimeSpan of the duration of the sample.</param> /// <returns>Size, in bytes, of the buffer.</returns> public int GetSampleSizeInBytes(TimeSpan duration) { // this should be 10ms aligned // this assumes 16bit mono data return(SoundEffect.GetSampleSizeInBytes(duration, _sampleRate, AudioChannels.Mono)); }
/// <summary> /// Returns the size, in bytes, of a buffer of the specified duration, based on the settings of this instance. /// </summary> /// <param name="duration">The playback length of the buffer.</param> /// <returns>The data size of the buffer, in bytes.</returns> public int GetSampleSizeInBytes(TimeSpan duration) { AssertNotDisposed(); return(SoundEffect.GetSampleSizeInBytes(duration, _sampleRate, _channels)); }