/// <summary> /// Initializes a new instance of the <see cref="AiffChunk" /> class. /// </summary> /// <param name="binaryReader">The binary reader which provides can be used to decode the chunk.</param> /// <param name="chunkId">The chunk identifier.</param> /// <exception cref="System.ArgumentNullException"> /// binaryReader /// or /// chunkId /// </exception> public AiffChunk(BinaryReader binaryReader, string chunkId) { if (binaryReader == null) { throw new ArgumentNullException("binaryReader"); } if (string.IsNullOrEmpty(chunkId)) { throw new ArgumentNullException("chunkId"); } BinaryReader = binaryReader; ChunkStartPosition = BinaryReader.BaseStream.Position - 4; //sub the chunkid ChunkId = chunkId; Reader = new AiffBinaryReader(binaryReader); //ChunkId = binaryReader.ReadChars(4); DataSize = Reader.ReadInt32(); //if odd -> add a zero pad byte at the end if (DataSize % 2 != 0) { DataSize++; } }
/// <summary> /// Initializes a new instance of the <see cref="AiffChunk" /> class. /// </summary> /// <param name="binaryReader">The binary reader which provides can be used to decode the chunk.</param> /// <param name="chunkId">The chunk identifier.</param> /// <exception cref="System.ArgumentNullException"> /// binaryReader /// or /// chunkId /// </exception> public AiffChunk(BinaryReader binaryReader, string chunkId) { if (binaryReader == null) throw new ArgumentNullException("binaryReader"); if (string.IsNullOrEmpty(chunkId)) throw new ArgumentNullException("chunkId"); BinaryReader = binaryReader; ChunkStartPosition = BinaryReader.BaseStream.Position - 4; //sub the chunkid ChunkId = chunkId; Reader = new AiffBinaryReader(binaryReader); //ChunkId = binaryReader.ReadChars(4); DataSize = Reader.ReadInt32(); //if odd -> add a zero pad byte at the end if (DataSize % 2 != 0) DataSize++; }