// トラックのイベントを読み込む. private void ReadTrack(AByteArray aByteArray) { int lDelta = 0; byte lStatePre = 0; int lPositionPre = aByteArray.Position; // トラック終了まで読み込む. while (aByteArray.Position < lPositionPre + size) { lDelta += GetVariableLengthByte(aByteArray); byte lState = aByteArray.ReadByte(); // ランニングステータス対応. if (lState < 0x80) { lState = lStatePre; aByteArray.SubPosition(1); } lStatePre = lState; if (lState != 0xFF) { // MIDIイベント読み込み. MidiEventBase lMidiEvent = MidiEventReader.Execute(lDelta, lState, aByteArray); midiEventList.Add(lMidiEvent); } else { // メタイベント読み込み. MetaEventBase lMetaEvent = MetaEventReader.Execute(lDelta, aByteArray); metaEventList.Add(lMetaEvent); } } }