private void InitWAVFile(byte[] data, int channels, int sampleRate) { HeaderSize = 0x2C; Data = new DataChunk(data); FMT = new WAVFMTChunk(channels, sampleRate); RIFF = new RIFFChunk(data.Length, Data.ChunkSize + FMT.ChunkSize); if (Data.ChunkSize + FMT.ChunkSize + RIFF.ChunkSize == HeaderSize) { isValid = true; } TotalSize = HeaderSize + Data.GetDataLength(); }
private void InitXMAFile(byte[] data, int channels, int sampleRate) { // More like min header size in this case HeaderSize = 0x3C; Data = new DataChunk(data); FMT = new XMAFMTChunk(channels, sampleRate); RIFF = new RIFFChunk(data.Length, Data.ChunkSize + FMT.ChunkSize); RealHeaderSize = Data.ChunkSize + FMT.ChunkSize + RIFF.ChunkSize; TotalSize = RealHeaderSize + Data.GetDataLength(); // Not a solid verification but whatever if (RealHeaderSize >= HeaderSize) { isValid = true; } }