Exemple #1
0
        private void parseData(SectionedFile sections)
        {
            uint instrumentCount;

            var section    = sections.FindSection("DATA");
            var baseStream = sections.Open(section);

            using (var r = new BinaryReader(new SubStream(baseStream, 0))) {
                r.Skip(8 * 4);
                instrumentCount = r.ReadUInt32();

                instruments = new List <Instrument>((int)instrumentCount);
                for (int instrumentIndex = 0; instrumentIndex < instrumentCount; ++instrumentIndex)
                {
                    byte instrumentType = r.ReadByte();
                    long offset         = r.Read3ByteUInt();
                    //for some inane reason, everything is offset from the start of the file, not the section
                    offset -= section.position;

                    if (instrumentType == 0)
                    {
                        instruments.Add(null);
                        continue;
                    }

                    var instrument = Instrument.parseRecord(instrumentType, new SubStream(baseStream, offset));
                    instruments.Add(instrument);
                }
            }
        }
Exemple #2
0
        private void ParseData(SectionedFile sections)
        {
            var          section       = sections.FindSection("DATA");
            var          sectionStream = sections.Open(section);
            BinaryReader reader        = new BinaryReader(sectionStream);

            //for some inane reason it's prefixed with the offset into the file for the data itself
            long offset = reader.ReadUInt32();

            offset -= section.position;

            var commandStream = new SubStream(sectionStream, offset);

            var parser = new SequenceParser(commandStream);

            sequence = parser.Parse();
        }