public WaveFormatExtensible(ESampleRate rate, EBitDepth bits, ESpeakerConfiguration channelMask, Guid subFormat) : base(rate, bits, channelMask, WaveFormatEncoding.Extensible, Marshal.SizeOf(typeof(WaveFormatExtensible))) { wValidBitsPerSample = (short)bits; dwChannelMask = (int)channelMask; this.subFormat = subFormat; }
protected WaveFormat(ESampleRate rate, EBitDepth bits, ESpeakerConfiguration channelMask, WaveFormatEncoding formatTag, int totalSize) { channels = ChannelsFromMask((int)channelMask); if (channels < 1) { throw new ArgumentOutOfRangeException(nameof(channelMask), "Channels must be 1 or greater"); } SampleRate = (int)rate; BitsPerSample = (short)bits; cbSize = 0; //blockAlign = (short)(channels * (bitsPerSample / 8)); //avgBytesPerSec = samplesPerSec * blockAlign; this.formatTag = formatTag; cbSize = (short)(totalSize - Marshal.SizeOf(typeof(WaveFormat))); }
public WaveFormat(ESampleRate rate, EBitDepth bits, ESpeakerConfiguration channelMask) : this(rate, bits, channelMask, WaveFormatEncoding.Pcm, Marshal.SizeOf(typeof(WaveFormat))) { }
/// <summary> /// Creates a new WaveFormatExtensible for PCM /// WMMEDIASUBTYPE_PCM("00000001-0000-0010-8000-00AA00389B71") /// </summary> public WaveFormatExtensible(ESampleRate rate, EBitDepth bits, ESpeakerConfiguration channelMask) : this(rate, bits, channelMask, new Guid("00000001-0000-0010-8000-00AA00389B71")) { }