NAudio.Wave.WaveFormat.ReadWaveFormat C# (CSharp) Method

ReadWaveFormat() private method

private ReadWaveFormat ( BinaryReader br, int formatChunkLength ) : void
br System.IO.BinaryReader
formatChunkLength int
return void
        private void ReadWaveFormat(BinaryReader br, int formatChunkLength)
        {
            if (formatChunkLength < 16)
                throw new InvalidDataException("Invalid WaveFormat Structure");
            this.waveFormatTag = (WaveFormatEncoding)br.ReadUInt16();
            this.channels = br.ReadInt16();
            this.sampleRate = br.ReadInt32();
            this.averageBytesPerSecond = br.ReadInt32();
            this.blockAlign = br.ReadInt16();
            this.bitsPerSample = br.ReadInt16();
            if (formatChunkLength > 16)
            {
                this.extraSize = br.ReadInt16();
                if (this.extraSize != formatChunkLength - 18)
                {
                    Debug.WriteLine("Format chunk mismatch");
                    this.extraSize = (short)(formatChunkLength - 18);
                }
            }
        }