public void Open() { filedata = File.ReadAllBytes(FileName); header = new XMHeader(filedata); patterns = new XMPattern[header.NumberOfPatterns]; instruments = new XMInstrument[header.NumberOfInstruments]; //int offset = XMHeader.Consts.PatternOrderTable + header.SongLengthInPatterns;// PatternStartAt; int offset = XMHeader.Consts.HeaderSize + header.HeaderSize;// PatternStartAt; for (int patternnumber = 0; patternnumber < header.NumberOfPatterns; patternnumber++) { XMPattern pattern = new XMPattern(filedata, offset, header); patterns[patternnumber] = pattern; offset += (pattern.SizeOfPatternData + pattern.LenghtOfPatternHeader); } for (int instrumentnumber = 0; instrumentnumber < header.NumberOfInstruments; instrumentnumber++) { XMInstrument instrument = new XMInstrument(filedata, offset); instruments[instrumentnumber] = instrument; offset = instrument.nextinstrumentofset; } }
public XMPattern(byte[] filedata, int offset, XMHeader xmheader) { this.filedata = filedata; this.offset = offset; this.xmheader = xmheader; }