private short[] wavData; // Actual WAVE file data #endregion Fields #region Constructors /// <summary> /// Class constructor /// </summary> /// <param name="br"></param> /// <param name="_wavFile"></param> public DataChunk(BinaryReader br, FMTChunk _ftChunk) { byte[] buffer = br.ReadBytes(8); byte[] temp; ftChunk = _ftChunk; chunkID = Utilities.getString(buffer, 4, 0); temp = Utilities.getBytes(buffer, 4, 4); chunkSize = Utilities.getIntegerValue(temp); wavData = new short[chunkSize/2]; for (uint i = 0; i < chunkSize / 2; i++) { wavData[i] = br.ReadInt16(); } }
private WavDataCharacteristics wd = null; // Class that encapsulates properties of wav data #endregion Fields #region Constructors private WavFile(BinaryReader br) { rf = new RIFFChunk(br); if (rf.validate() == false) throw new Exception("RIFF chunk invalid"); ft = new FMTChunk(br); if (ft.validate() == false) { // ft.printInfo(); throw new Exception("FMT chunk invalid. WAVE file is not 8KHz 16bit Mono PCM WAVE file."); } dt = new DataChunk(br, ft); if (dt.validate() == false) { throw new Exception("Data Chunk invalid"); } wd = dt.analyzePCMData(); }