public void SysExEvent() { var ticks = 25463u; var data = new byte[] { 255, 32, 7, 65, 35, 42 }; var x = new SysExEvent(ticks, data); var y = ReDeserialize(x); Assert.That(x.Ticks == y.Ticks); Assert.That(x.data.SequenceEqual(y.data)); }
private void SendSysExEvent(SysExEvent sysExEvent) { var data = sysExEvent.Data; if (data == null || !data.Any()) { return; } var headerPointer = PrepareSysExBuffer(data); _sysExHeadersPointers.Add(headerPointer); ProcessMmResult(MidiOutWinApi.midiOutLongMsg(_handle, headerPointer, MidiWinApi.MidiHeaderSize)); }
public SysExEventLabel(SysExEvent sysExEvent) : base(sysExEvent) { }
private static void ProcessSysEx(MidiPort port, MidiEvent e) { SysExEvent midiEvent = e as SysExEvent; if (midiEvent != null) { sysExData[(int)port - 1].AddRange(midiEvent.Data); if (midiEvent.Completed) { List <byte> data = sysExData[(int)port - 1]; try { if (data[data.Count - 1] != 0xf7) //END SysEx { return; } if (!(data.Count >= 1)) { return; } switch (data[0]) { //All device case 0x7f: if (data.Count <= 1) { break; } switch (data[1]) { //All device case 0x7f: if (data.Count <= 2) { break; } switch (data[2]) { //COMMON case 0x04: { if (data.Count <= 3) { break; } switch (data[3]) { //MASTER VOLUME case 0x01: { if (data.Count > 6) { InstrumentBase.MasterGain = (float)data[5] / 127f; } break; } } break; } } break; } break; //GM case 0x7e: if (data.Count <= 1) { break; } switch (data[1]) { //All device case 0x7f: if (data.Count <= 2) { break; } switch (data[2]) { // case 0x09: if (data.Count <= 3) { break; } switch (data[3]) { //GM RESET case 0x01: { Panic(); Reset(); break; } } break; } break; } break; //Roland case 0x41: if (data.Count <= 1) { break; } switch (data[1]) { //All device default: if (data.Count <= 2) { break; } switch (data[2]) { // case 0x42: if (data.Count <= 3) { break; } switch (data[3]) { case 0x12: { if (data.Count <= 6) { break; } //GS RESET if (data[4] == 0x40 && data[5] == 0x00 && data[6] == 0x7f) { Panic(); Reset(); } break; } } break; } break; } break; } } finally { data.Clear(); } } } }
// Token: 0x06002A65 RID: 10853 RVA: 0x00138278 File Offset: 0x00136478 private static void smethod_7(EventsCollection eventsCollection_0, Song gclass27_0, Song.Instrument genum18_0) { List <NoteOnEvent> list = new List <NoteOnEvent>(500); List <SysExEvent> list2 = new List <SysExEvent>(500); List <int> list3 = new List <int>(10); int num = (int)(64f * gclass27_0.float_3 / GClass15.float_0); bool flag = false; if (!GClass30.bool_0 && SongEntry.currentSongMultiplierNote == 0) { int num2 = 0; for (int i = 0; i < eventsCollection_0.Count; i++) { NoteOnEvent noteOnEvent = eventsCollection_0[i] as NoteOnEvent; if (noteOnEvent != null && noteOnEvent.OffEvent != null) { if (noteOnEvent.NoteNumber == 103) { num2++; } else if (noteOnEvent.NoteNumber == 116) { num2 = 0; IL_A6: if (num2 >= 2) { flag = true; goto IL_AE; } goto IL_AE; } } } goto IL_A6; } IL_AE: int j = 0; while (j < eventsCollection_0.Count) { NoteOnEvent noteOnEvent2 = eventsCollection_0[j] as NoteOnEvent; if (noteOnEvent2 == null || noteOnEvent2.OffEvent == null) { goto IL_4E6; } uint num3 = (uint)noteOnEvent2.AbsoluteTime; uint num4 = (uint)(noteOnEvent2.OffEvent.AbsoluteTime - (long)((ulong)num3)); if (!GClass30.bool_0) { if (noteOnEvent2.NoteNumber != 116) { if (!flag || noteOnEvent2.NoteNumber != 103) { if (noteOnEvent2.NoteNumber == 103) { using (IEnumerator enumerator = Enum.GetValues(typeof(Song.GEnum17)).GetEnumerator()) { while (enumerator.MoveNext()) { object obj = enumerator.Current; Song.GEnum17 genum17_ = (Song.GEnum17)obj; gclass27_0.method_59(genum18_0, genum17_).list_1.Add(new GClass8(gclass27_0.method_52((uint)noteOnEvent2.AbsoluteTime), gclass27_0.method_2((uint)noteOnEvent2.AbsoluteTime, (uint)noteOnEvent2.OffEvent.AbsoluteTime), (uint)noteOnEvent2.AbsoluteTime, (uint)noteOnEvent2.OffEvent.AbsoluteTime)); } goto IL_564; } } byte b = noteOnEvent2.NoteNumber; if (b <= 78) { if (b - 65 > 1 && b - 77 > 1) { goto IL_28F; } } else if (b - 89 > 1 && b - 101 > 1) { goto IL_28F; } list.Add(noteOnEvent2); goto IL_564; } } using (IEnumerator enumerator = Enum.GetValues(typeof(Song.GEnum17)).GetEnumerator()) { while (enumerator.MoveNext()) { object obj2 = enumerator.Current; Song.GEnum17 genum17_2 = (Song.GEnum17)obj2; gclass27_0.method_59(genum18_0, genum17_2).method_12(new GClass20(num3, num4), false); } goto IL_564; } } IL_28F: GClass19.GEnum13 genum13_ = GClass19.GEnum13.GREEN; if ((ulong)num4 <= (ulong)((long)num)) { num4 = 0u; } if (genum18_0 == Song.Instrument.GHLGuitar) { goto IL_399; } if (genum18_0 == Song.Instrument.GHLBass) { goto IL_399; } switch (noteOnEvent2.NoteNumber) { case 60: case 72: case 84: case 96: genum13_ = GClass19.GEnum13.GREEN; break; case 61: case 73: case 85: case 97: genum13_ = GClass19.GEnum13.RED; break; case 62: case 74: case 86: case 98: genum13_ = GClass19.GEnum13.YELLOW; break; case 63: case 75: case 87: case 99: genum13_ = GClass19.GEnum13.BLUE; break; case 64: case 76: case 88: case 100: genum13_ = GClass19.GEnum13.ORANGE; break; case 65: case 66: case 67: case 68: case 69: case 70: case 71: case 77: case 78: case 79: case 80: case 81: case 82: case 83: case 89: case 90: case 91: case 92: case 93: case 94: case 95: case 101: goto IL_564; default: goto IL_564; } IL_483: Song.GEnum17 genum; try { genum = GClass30.smethod_8((int)noteOnEvent2.NoteNumber); if (GClass30.bool_0 && list3.Contains((int)genum)) { goto IL_564; } } catch { goto IL_564; } gclass27_0.method_59(genum18_0, genum).method_12(new GClass19(num3, genum13_, num4, GClass19.GEnum15.NONE), GClass30.bool_0); if (GClass30.bool_0) { list3.Add((int)genum); goto IL_564; } goto IL_4E6; IL_399: switch (noteOnEvent2.NoteNumber) { case 58: case 70: case 82: case 94: genum13_ = GClass19.GEnum13.OPEN; goto IL_483; case 59: case 71: case 83: case 95: genum13_ = GClass19.GEnum13.W1; goto IL_483; case 60: case 72: case 84: case 96: genum13_ = GClass19.GEnum13.W2; goto IL_483; case 61: case 73: case 85: case 97: genum13_ = GClass19.GEnum13.W3; goto IL_483; case 62: case 74: case 86: case 98: genum13_ = GClass19.GEnum13.B1; goto IL_483; case 63: case 75: case 87: case 99: genum13_ = GClass19.GEnum13.B2; goto IL_483; case 64: case 76: case 88: case 100: genum13_ = GClass19.GEnum13.B3; goto IL_483; case 65: case 66: case 67: case 68: case 69: case 77: case 78: case 79: case 80: case 81: case 89: case 90: case 91: case 92: case 93: goto IL_483; default: goto IL_483; } IL_564: j++; continue; IL_4E6: if (GClass30.bool_0) { goto IL_564; } TextEvent textEvent = eventsCollection_0[j] as TextEvent; if (textEvent != null && textEvent.Text != null) { uint uint_ = (uint)textEvent.AbsoluteTime; string string_ = textEvent.Text.Trim(new char[] { '[', ']' }); gclass27_0.method_59(genum18_0, Song.GEnum17.Expert).method_12(new ChartEvent(uint_, string_), true); } SysExEvent sysExEvent = eventsCollection_0[j] as SysExEvent; if (sysExEvent != null) { list2.Add(sysExEvent); goto IL_564; } goto IL_564; } foreach (object obj3 in Enum.GetValues(typeof(Song.GEnum17))) { Song.GEnum17 genum17_3 = (Song.GEnum17)obj3; gclass27_0.method_59(genum18_0, genum17_3).method_18(); } if (!GClass30.bool_0) { Array values = Enum.GetValues(typeof(Song.GEnum17)); GClass26[] array = new GClass26[values.Length]; int num5 = 0; foreach (object obj4 in values) { Song.GEnum17 genum17_4 = (Song.GEnum17)obj4; array[num5++] = gclass27_0.method_59(genum18_0, genum17_4); } for (int k = 0; k < list2.Count; k++) { SysExEvent sysExEvent2 = list2[k]; byte[] data = sysExEvent2.Data; if (data.Length == 8 && data[4] == 255 && data[6] == 1) { uint num6 = (uint)sysExEvent2.AbsoluteTime; uint num7 = 0u; for (int l = k; l < list2.Count; l++) { SysExEvent sysExEvent3 = list2[l]; byte[] data2 = sysExEvent3.Data; if (data2.Length == 8 && data2[4] == 255 && data2[6] == 0) { num7 = (uint)(sysExEvent3.AbsoluteTime - (long)((ulong)num6)); IL_6D3: foreach (GClass26 gclass in array) { int num8; int num9; GClass16.smethod_18 <GClass19>(gclass.GClass19_0, num6, num6 + num7, out num8, out num9); for (int n = num8; n < num8 + num9; n++) { gclass.GClass19_0[n].method_18(GClass19.GEnum14.Tap); } } goto IL_83C; } } goto IL_6D3; } if (data.Length == 8 && data[4] >= 0 && data[4] < 4 && data[6] == 1) { uint num10 = (uint)sysExEvent2.AbsoluteTime; Song.GEnum17 genum17_5; switch (data[4]) { case 0: genum17_5 = Song.GEnum17.Easy; break; case 1: genum17_5 = Song.GEnum17.Medium; break; case 2: genum17_5 = Song.GEnum17.Hard; break; case 3: genum17_5 = Song.GEnum17.Expert; break; default: goto IL_83C; } uint num11 = 0u; for (int num12 = k; num12 < list2.Count; num12++) { SysExEvent sysExEvent4 = list2[num12]; if (sysExEvent4 != null) { byte[] data3 = sysExEvent4.Data; if (data3.Length == 8 && data3[4] == data[4] && data3[6] == 0) { num11 = (uint)(sysExEvent4.AbsoluteTime - (long)((ulong)num10)); if (num11 > 0u) { num11 -= 1u; } IL_7FA: GClass19[] gclass19_ = gclass27_0.method_59(genum18_0, genum17_5).GClass19_0; int num13; int num14; GClass16.smethod_18 <GClass19>(gclass19_, num10, num10 + num11, out num13, out num14); for (int num15 = num13; num15 < num13 + num14; num15++) { gclass19_[num15].genum13_0 = GClass19.GEnum13.OPEN; } goto IL_83C; } } } goto IL_7FA; } IL_83C :; } int num16 = 0; while (num16 < list.Count) { uint num17 = (uint)list[num16].AbsoluteTime; uint num18 = (uint)list[num16].OffEvent.AbsoluteTime; if (num18 - num17 != 0u) { num18 -= 1u; } Song.GEnum17 genum17_6; try { genum17_6 = GClass30.smethod_8((int)list[num16].NoteNumber); } catch { goto IL_927; } goto IL_8A8; IL_927: num16++; continue; IL_8A8: GClass26 gclass2 = gclass27_0.method_59(genum18_0, genum17_6); int num19; int num20; GClass16.smethod_18 <GClass19>(gclass2.GClass19_0, num17, num18, out num19, out num20); for (int num21 = num19; num21 < num19 + num20; num21++) { if ((gclass2.GClass19_0[num21].genum15_0 & GClass19.GEnum15.TAP) == GClass19.GEnum15.NONE) { if (list[num16].NoteNumber % 2 != 0) { gclass2.GClass19_0[num21].method_18(GClass19.GEnum14.Hopo); } else { gclass2.GClass19_0[num21].method_18(GClass19.GEnum14.Strum); } } } goto IL_927; } } }