public INFO(bool HasTracks) { Signature = "INFO"; StreamSoundInfoReference = new SectionInfo(0x4100); TrackInfoReference = new SectionInfo((uint)(HasTracks ? 0x101 : 0)); ChannelInfoReference = new SectionInfo(0x101); StreamInfo = new StreamSoundInfo(); if (HasTracks) { TrackInfoReferenceTable = new ReferenceTable(); } ChannelInfoReferenceTable = new ReferenceTable(); }
public INFO(EndianBinaryReader er) { Signature = er.ReadString(Encoding.ASCII, 4); if (Signature != "INFO") { throw new SignatureNotCorrectException(Signature, "INFO", er.BaseStream.Position - 4); } SectionSize = er.ReadUInt32(); long offs = er.BaseStream.Position; StreamSoundInfoReference = new SectionInfo(er); TrackInfoReference = new SectionInfo(er); ChannelInfoReference = new SectionInfo(er); er.BaseStream.Position = offs + StreamSoundInfoReference.Offset; StreamInfo = new StreamSoundInfo(er); if ((int)TrackInfoReference.Offset != -1) { er.BaseStream.Position = offs + TrackInfoReference.Offset; TrackInfoReferenceTable = new ReferenceTable(er); } er.BaseStream.Position = offs + ChannelInfoReference.Offset; ChannelInfoReferenceTable = new ReferenceTable(er); int i; if ((int)TrackInfoReference.Offset != -1) { TrackInfos = new TrackInfo[TrackInfoReferenceTable.NrEntries]; i = 0; foreach (var v in TrackInfoReferenceTable.Entries) { er.BaseStream.Position = offs + TrackInfoReference.Offset + v.Offset; TrackInfos[i] = new TrackInfo(er); i++; } } ChannelInfos = new ChannelInfo[ChannelInfoReferenceTable.NrEntries]; i = 0; foreach (var v in ChannelInfoReferenceTable.Entries) { er.BaseStream.Position = offs + ChannelInfoReference.Offset + v.Offset; ChannelInfos[i] = new ChannelInfo(er); i++; } if (StreamInfo.Format == 2) { CodecInfos = new DSPADPCMCodecInfo[ChannelInfoReferenceTable.NrEntries]; i = 0; foreach (var v in ChannelInfos) { if ((int)v.CodecInfoOffset == -1) { i++; continue; } er.BaseStream.Position = offs + ChannelInfoReference.Offset + ChannelInfoReferenceTable.Entries[i].Offset + v.CodecInfoOffset; CodecInfos[i] = new DSPADPCMCodecInfo(er); i++; } } else { } }