예제 #1
0
        public Ps2SequenceData(Stream pStream)
        {
            this.versionChunk = parseVersionChunk(pStream);
            this.headerChunk  = parseHeaderChunk(pStream);
            this.midiChunk    = parseMidiChunk(pStream);

            dataBytesPerCommand = new Dictionary <int, int>();
            dataBytesPerCommand.Add(0x80, 1);
            dataBytesPerCommand.Add(0x90, 2);
            dataBytesPerCommand.Add(0xA0, 2);
            dataBytesPerCommand.Add(0xB0, 2);
            dataBytesPerCommand.Add(0xC0, 1);
            dataBytesPerCommand.Add(0xD0, 1);
            dataBytesPerCommand.Add(0xE0, 2);
            dataBytesPerCommand.Add(0xF0, 0);
        }
예제 #2
0
        public static MidiChunkStruct parseMidiChunk(Stream pStream)
        {
            MidiChunkStruct ret = new MidiChunkStruct();

            ret.magicBytes        = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(pStream, MIDI_CHUNK_OFFSET + 0, 4), 0);
            ret.magicBytesSection = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(pStream, MIDI_CHUNK_OFFSET + 4, 4), 0);
            ret.chunkSize         = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(pStream, MIDI_CHUNK_OFFSET + 8, 4), 0);
            ret.maxSeqCount       = BitConverter.ToUInt32(ParseFile.ParseSimpleOffset(pStream, MIDI_CHUNK_OFFSET + 12, 4), 0);

            ret.subSeqOffsetAddr = new int[ret.maxSeqCount + 1];

            for (int i = 0; i < ret.subSeqOffsetAddr.Length; i++)
            {
                ret.subSeqOffsetAddr[i] = BitConverter.ToInt32(ParseFile.ParseSimpleOffset(pStream, MIDI_CHUNK_OFFSET + 16 + (4 * i), 4), 0);
            }

            return(ret);
        }