示例#1
0
 private void method_3(Stream midiStream)
 {
     BinaryReader midiFile = new BinaryReader(midiStream);
     ByteFiddler.smethod_3("MIDI", midiFile, "MThd");
     ByteFiddler.RotateLeft(midiFile.ReadUInt32());
     ByteFiddler.RotateRight(midiFile.ReadUInt16());
     int num = (int)ByteFiddler.RotateRight(midiFile.ReadUInt16());
     this.method_1((int)ByteFiddler.RotateRight(midiFile.ReadUInt16()));
     this.midiLineList.Clear();
     for (int i = 0; i < num; i++)
     {
         MIDILine midiLine = new MIDILine(this.method_0());
         this.midiLineList.Add(midiLine);
         List<AbstractNoteClass> list = new List<AbstractNoteClass>();
         ByteFiddler.smethod_3("MIDI", midiFile, "MTrk");
         uint num2 = ByteFiddler.RotateLeft(midiFile.ReadUInt32());
         long position = midiFile.BaseStream.Position;
         int num3 = 0;
         byte b = 0;
         while (midiFile.BaseStream.Position < position + (long)((ulong)num2))
         {
             int num4 = (int)this.method_4(midiFile);
             AbstractNoteClass midiNote = null;
             num3 += num4;
             byte b2 = midiFile.ReadByte();
             if (b2 != 255)
             {
                 byte int_;
                 if ((b2 & 128) == 128)
                 {
                     int_ = midiFile.ReadByte();
                     b = b2;
                 }
                 else
                 {
                     int_ = b2;
                     b2 = b;
                 }
                 byte b3 = (byte)(b2 >> 4);
                 switch (b3)
                 {
                 case 8:
                     midiNote = new MIDINote(num3, (int)int_, midiFile.ReadByte(), false);
                     goto IL_298;
                 case 9:
                     midiNote = new MIDINote(num3, (int)int_, midiFile.ReadByte(), true);
                     goto IL_298;
                 case 11:
                 case 12:
                 case 14:
                     goto IL_298;
                 }
                 throw new NotImplementedException(string.Format("Unhandled MIDI command: {0} at position {1}", b3.ToString("X"), midiFile.BaseStream.Position));
             }
             byte b4 = midiFile.ReadByte();
             long num5 = this.method_4(midiFile);
             byte[] array = midiFile.ReadBytes((int)num5);
             byte b5 = b4;
             if (b5 <= 47)
             {
                 switch (b5)
                 {
                 case 1:
                     midiNote = new zzNote1(num3, zzNote1.Enum37.const_0, Encoding.ASCII.GetString(array));
                     break;
                 case 2:
                     break;
                 case 3:
                 {
                     string text = Encoding.ASCII.GetString(array).ToUpper();
                     if (!string.IsNullOrEmpty(text))
                     {
                         midiLine.method_3(text);
                     }
                     break;
                 }
                 default:
                     if (b5 != 47)
                     {
                     }
                     break;
                 }
             }
             else if (b5 != 81)
             {
                 if (b5 == 88)
                 {
                     if (num5 != 4L)
                     {
                         Class355.interface15_0.imethod_1(string.Format("Expected time signature event to have data length of 4, but found instead {0}", num5));
                     }
                     midiNote = new zzNote338(num3, (int)array[0], (int)array[1], (int)array[2], (int)array[3]);
                 }
             }
             else
             {
                 if (num5 != 3L)
                 {
                     Class355.interface15_0.imethod_1(string.Format("Expected tempo event to have data length of 3, but found instead {0}", num5));
                 }
                 int num6 = (int)array[0] << 16;
                 num6 |= (int)array[1] << 8;
                 num6 |= (int)array[2];
                 midiNote = new BpmNote1(num3, num6);
             }
             IL_298:
             if (midiNote != null)
             {
                 list.Add(midiNote);
             }
         }
         list.Sort(new Comparison<AbstractNoteClass>(AbstractNoteClass.smethod_0));
         midiLine.method_1(list);
         midiFile.BaseStream.Seek(position + (long)((ulong)num2), SeekOrigin.Begin);
     }
 }
示例#2
0
 private void method_3(int instrumentType, int int_1, MIDINote midiNote, int int_2)
 {
     NoteEventInterpreter noteEvenInterpreter = null;
     switch (midiNote.getDifficulty())
     {
     case Difficulty.Easy:
         switch (instrumentType)
         {
         case 0:
             noteEvenInterpreter = this.easySingle;
             break;
         case 1:
             noteEvenInterpreter = this.easyDoubleGuitar;
             break;
         case 3:
             noteEvenInterpreter = this.easyDoubleBass;
             break;
         }
         break;
     case Difficulty.Medium:
         switch (instrumentType)
         {
         case 0:
             noteEvenInterpreter = this.mediumSingle;
             break;
         case 1:
             noteEvenInterpreter = this.mediumDoubleGuitar;
             break;
         case 3:
             noteEvenInterpreter = this.mediumDoubleBass;
             break;
         }
         break;
     case Difficulty.Hard:
         switch (instrumentType)
         {
         case 0:
             noteEvenInterpreter = this.hardSingle;
             break;
         case 1:
             noteEvenInterpreter = this.hardDoubleGuitar;
             break;
         case 3:
             noteEvenInterpreter = this.hardDoubleBass;
             break;
         }
         break;
     case Difficulty.Expert:
         switch (instrumentType)
         {
         case 0:
             noteEvenInterpreter = this.expertSingle;
             break;
         case 1:
             noteEvenInterpreter = this.expertDoubleGuitar;
             break;
         case 3:
             noteEvenInterpreter = this.expertDoubleBass;
             break;
         }
         break;
     default:
         if (!this.bool_3 && midiNote.method_2() == MIDINoteMask.StarPower)
         {
             this.bool_3 = true;
             this.expertSingle.class228_1.Clear();
             this.hardSingle.class228_1.Clear();
             this.mediumSingle.class228_1.Clear();
             this.easySingle.class228_1.Clear();
         }
         else if (!this.bool_3)
         {
             return;
         }
         break;
     }
     if (midiNote.method_3() != Fret.Invalid)
     {
         if (noteEvenInterpreter.noteList.method_4(int_1))
         {
             noteEvenInterpreter.noteList[int_1].noteValues[(int)midiNote.method_3()] = true;
             return;
         }
         bool[] array = new bool[32];
         array[(int)midiNote.method_3()] = true;
         noteEvenInterpreter.noteList.Add(int_1, new NotesAtOffset(array, int_2));
         return;
     }
     else
     {
         if (midiNote.method_2() == MIDINoteMask.StarPower && !this.expertSingle.class228_1.ContainsKey(int_1))
         {
             this.expertSingle.class228_1.Add(int_1, int_2);
             this.hardSingle.class228_1.Add(int_1, int_2);
             this.mediumSingle.class228_1.Add(int_1, int_2);
             this.easySingle.class228_1.Add(int_1, int_2);
             return;
         }
         if (midiNote.method_2() == MIDINoteMask.Unk7 && !noteEvenInterpreter.class228_1.ContainsKey(int_1) && !this.bool_3)
         {
             noteEvenInterpreter.class228_1.Add(int_1, int_2);
             return;
         }
         if (midiNote.method_2() == MIDINoteMask.Unk9 && !noteEvenInterpreter.class228_2.ContainsKey(int_1))
         {
             noteEvenInterpreter.class228_2.Add(int_1, int_2);
             return;
         }
         if (midiNote.method_2() == MIDINoteMask.Unk10 && !noteEvenInterpreter.class228_3.ContainsKey(int_1))
         {
             noteEvenInterpreter.class228_3.Add(int_1, int_2);
         }
         return;
     }
 }