static byte[] GetInstrumentBytes(Song song, Song.Instrument instrument, ExportOptions exportOptions, float resolutionScaleRatio) { // Collect all bytes from each difficulty of the instrument, assigning the position for each event unsorted //List<SortableBytes> byteEvents = new List<SortableBytes>(); SortableBytes[] easyBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Easy, exportOptions); SortableBytes[] mediumBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Medium, exportOptions); SortableBytes[] hardBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Hard, exportOptions); SortableBytes[] expertBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Expert, exportOptions); SortableBytes[] em = SortableBytes.MergeAlreadySorted(easyBytes, mediumBytes); SortableBytes[] he = SortableBytes.MergeAlreadySorted(hardBytes, expertBytes); List <SortableBytes> sortedEvents = new List <SortableBytes>(SortableBytes.MergeAlreadySorted(em, he)); // Perform merge sort to re-order everything correctly //SortableBytes[] sortedEvents = new SortableBytes[easyBytes.Length + mediumBytes.Length + hardBytes.Length + expertBytes.Length];//byteEvents.ToArray(); //SortableBytes.Sort(sortedEvents); // Strip out duplicate events. This may occur with cymbal flags across multiple difficulties for (int i = sortedEvents.Count - 1; i >= 0; --i) { int next = i + 1; while (next < sortedEvents.Count && sortedEvents[i].tick == sortedEvents[next].tick) { if (sortedEvents[i].bytes.SequenceEqual(sortedEvents[next].bytes)) { sortedEvents.RemoveAt(next); } ++next; } } return(SortableBytesToTimedEventBytes(sortedEvents.ToArray(), song, exportOptions, resolutionScaleRatio)); }
public void SetInstrument(string value) { try { currentInstrument = (Song.Instrument)System.Enum.Parse(typeof(Song.Instrument), value, true); } catch { Debug.LogError("Invalid instrument set: " + value); } desiredLaneCount = 0; }
// Token: 0x060000B7 RID: 183 RVA: 0x0001A808 File Offset: 0x00018A08 private GStruct1 method_38(Song.Instrument genum18_0) { GStruct1 gstruct1_ = GStruct1.GStruct1_0; switch (genum18_0) { case Song.Instrument.Bass: case Song.Instrument.GHLBass: gstruct1_.int_1 = 1; gstruct1_.int_0 = 1; break; case Song.Instrument.Keys: gstruct1_.int_1 = 11; gstruct1_.int_0 = 11; break; case Song.Instrument.Drums: gstruct1_.int_0 = 6; gstruct1_.int_1 = 10; break; case Song.Instrument.Vocals: gstruct1_.int_0 = 3; gstruct1_.int_1 = 5; break; case Song.Instrument.Crowd: gstruct1_.int_1 = 13; gstruct1_.int_0 = 13; break; case Song.Instrument.None: gstruct1_.int_1 = 99; gstruct1_.int_0 = 99; break; case Song.Instrument.Rhythm: gstruct1_.int_1 = 2; gstruct1_.int_0 = 2; break; } return(gstruct1_); }
// Token: 0x060000D0 RID: 208 RVA: 0x0001AFC4 File Offset: 0x000191C4 private GStruct1 method_60(Song.Instrument genum18_0) { GStruct1 result = GStruct1.smethod_12(); switch (genum18_0) { case Song.Instrument.Bass: case Song.Instrument.GHLBass: result.int_1 = 0; result.int_0 = 0; break; case Song.Instrument.Keys: result.int_1 = 62; result.int_0 = 62; break; case Song.Instrument.Drums: result.int_0 = 3; result.int_1 = -11; break; case Song.Instrument.Vocals: result.int_0 = 2; result.int_1 = 7; break; case Song.Instrument.Crowd: result.int_1 = 58; result.int_0 = 58; break; case Song.Instrument.None: result.int_1 = -6; result.int_0 = -6; break; case Song.Instrument.Rhythm: result.int_1 = 4; result.int_0 = 4; break; } return(result); }
static byte[] GetInstrumentBytes(Song song, Song.Instrument instrument, ExportOptions exportOptions) { // Collect all bytes from each difficulty of the instrument, assigning the position for each event unsorted //List<SortableBytes> byteEvents = new List<SortableBytes>(); SortableBytes[] easyBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Easy, exportOptions); SortableBytes[] mediumBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Medium, exportOptions); SortableBytes[] hardBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Hard, exportOptions); SortableBytes[] expertBytes = GetChartSortableBytes(song, instrument, Song.Difficulty.Expert, exportOptions); SortableBytes[] em = SortableBytes.MergeAlreadySorted(easyBytes, mediumBytes); SortableBytes[] he = SortableBytes.MergeAlreadySorted(hardBytes, expertBytes); SortableBytes[] sortedEvents = SortableBytes.MergeAlreadySorted(em, he); // Perform merge sort to re-order everything correctly //SortableBytes[] sortedEvents = new SortableBytes[easyBytes.Length + mediumBytes.Length + hardBytes.Length + expertBytes.Length];//byteEvents.ToArray(); //SortableBytes.Sort(sortedEvents); return(SortableBytesToTimedEventBytes(sortedEvents, song, exportOptions)); }
// Token: 0x060000A0 RID: 160 RVA: 0x00019DB4 File Offset: 0x00017FB4 public void method_17(Song.Instrument genum18_0, bool bool_11) { if (!this.bool_7 || !GlobalVariables.instance.gclass5_31.Boolean_1) { return; } GStruct1 gstruct = this.method_38(genum18_0); if (gstruct.int_0 == -1) { return; } while (gstruct.int_0 <= gstruct.int_1) { int num = this.stemChannels[gstruct.int_0]; float value = bool_11 ? GlobalVariables.instance.volume_Stems[gstruct.int_0].Single_0 : GlobalVariables.instance.gclass5_15.Single_0; if (num != 0) { Bass.BASS_ChannelSetAttribute(num, BASSAttribute.BASS_ATTRIB_VOL, value); } gstruct.int_0++; } }
// Token: 0x060000BC RID: 188 RVA: 0x0001A8D8 File Offset: 0x00018AD8 public void method_43(string string_2, bool bool_11, Song.Instrument genum18_0 = Song.Instrument.None, Song.Instrument genum18_1 = Song.Instrument.None) { this.method_47(); if (!Directory.Exists(string_2)) { return; } int num = 0; this.bool_7 = true; this.bool_2 = false; GStruct1 gstruct = this.method_60(genum18_0); GStruct1 gstruct2 = this.method_38(genum18_1); for (int i = 1; i < this.stemChannels.Length; i++) { if ((i < gstruct.int_0 || i > gstruct.int_1) && (i < gstruct2.int_0 || i > gstruct2.int_1)) { string text = this.method_15(Path.Combine(string_2, BassAudioManager.stemPaths[i]), -1); if (text != null) { int num2 = Bass.BASS_StreamCreateFile(text, 1L, 0L, BASSFlag.BASS_SAMPLE_MONO | BASSFlag.BASS_SAMPLE_FX); if (num2 == 0) { this.stemChannels[i] = 0; } else { if (i < BassAudioManager.stemPaths.Length - 1) { num += 0; } this.stemChannels[i] = BassFx.BASS_FX_TempoCreate(num2, BASSFlag.BASS_SAMPLE_8BITS | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_VAM); Bass.BASS_ChannelSetAttribute(this.stemChannels[i], (BASSAttribute)(-147), (float)(bool_11 ? (GlobalVariables.instance.songSpeed.CurrentValue - 85) : 0)); long pos = Bass.BASS_ChannelGetLength(this.stemChannels[i]); double num3 = Bass.BASS_ChannelBytes2Seconds(this.stemChannels[i], pos); if (num3 > this.double_0) { this.linkedChannel = this.stemChannels[i]; this.double_0 = num3; } } } } } for (int j = 0; j < this.stemChannels.Length; j++) { if (this.stemChannels[j] != this.linkedChannel) { Bass.BASS_ChannelSetLink(this.linkedChannel, this.stemChannels[j]); } } if (this.stemChannels[1] == 0) { this.stemChannels[1] = this.stemChannels[6]; this.stemChannels[2] = 0; } if (num > 1) { this.bool_7 = true; } this.isSongLoaded = false; this.double_1 = this.double_0; }
// Token: 0x060000A9 RID: 169 RVA: 0x0001A144 File Offset: 0x00018344 public void LoadSong(string songFolder, bool isSpedUp, Song.Instrument excludedInstruments = Song.Instrument.None, Song.Instrument excludedInstruments2 = Song.Instrument.None) { this.method_47(); if (!Directory.Exists(songFolder)) { return; } int num = 0; this.bool_7 = false; this.bool_2 = false; GStruct1 gstruct = this.method_38(excludedInstruments); GStruct1 gstruct2 = this.method_38(excludedInstruments2); for (int i = 0; i < this.stemChannels.Length; i++) { if ((i < gstruct.int_0 || i > gstruct.int_1) && (i < gstruct2.int_0 || i > gstruct2.int_1)) { string text = this.method_15(Path.Combine(songFolder, BassAudioManager.stemPaths[i]), -1); if (text != null) { int num2 = Bass.BASS_StreamCreateFile(text, 0L, 0L, BASSFlag.BASS_STREAM_PRESCAN | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_ASYNCFILE); if (num2 == 0) { this.stemChannels[i] = 0; } else { if (i < BassAudioManager.stemPaths.Length - 1) { num++; } this.stemChannels[i] = BassFx.BASS_FX_TempoCreate(num2, BASSFlag.BASS_SAMPLE_OVER_VOL); Bass.BASS_ChannelSetAttribute(this.stemChannels[i], BASSAttribute.BASS_ATTRIB_TEMPO, (float)(isSpedUp ? (GlobalVariables.instance.songSpeed.CurrentValue - 100) : 1)); long pos = Bass.BASS_ChannelGetLength(this.stemChannels[i]); double num3 = Bass.BASS_ChannelBytes2Seconds(this.stemChannels[i], pos); if (num3 > this.double_0) { this.linkedChannel = this.stemChannels[i]; this.double_0 = num3; } } } } } for (int j = 0; j < this.stemChannels.Length; j++) { if (this.stemChannels[j] != this.linkedChannel) { Bass.BASS_ChannelSetLink(this.linkedChannel, this.stemChannels[j]); } } if (this.stemChannels[1] == 0) { this.stemChannels[1] = this.stemChannels[2]; this.stemChannels[2] = 0; } if (num > 1) { this.bool_7 = true; } this.isSongLoaded = true; this.double_1 = this.double_0; }
string GetSaveString <T>(Song song, IList <T> list, ExportOptions exportOptions, ref string out_errorList, Song.Instrument instrument = Song.Instrument.Guitar) where T : SongObject { System.Text.StringBuilder saveString = new System.Text.StringBuilder(); float resolutionScaleRatio = song.ResolutionScaleRatio(exportOptions.targetResolution); for (int i = 0; i < list.Count; ++i) { SongObject songObject = list[i]; try { uint tick = (uint)Mathf.Round(songObject.tick * resolutionScaleRatio) + exportOptions.tickOffset; saveString.Append(Globals.TABSPACE + tick); switch ((SongObject.ID)songObject.classID) { case (SongObject.ID.BPM): BPM bpm = songObject as BPM; if (bpm.anchor != null) { uint anchorValue = (uint)((double)bpm.anchor * 1000000); saveString.AppendFormat(s_anchorFormat, anchorValue, tick); } saveString.AppendFormat(s_bpmFormat, bpm.value); break; case (SongObject.ID.TimeSignature): TimeSignature ts = songObject as TimeSignature; if (ts.denominator == 4) { saveString.AppendFormat(s_tsFormat, ts.numerator); } else { uint denominatorSaveVal = (uint)Mathf.Log(ts.denominator, 2); saveString.AppendFormat(s_tsDenomFormat, ts.numerator, denominatorSaveVal); } break; case (SongObject.ID.Section): Section section = songObject as Section; saveString.AppendFormat(s_sectionFormat, section.title); break; case (SongObject.ID.Event): Event songEvent = songObject as Event; saveString.AppendFormat(s_eventFormat, songEvent.title); break; case (SongObject.ID.ChartEvent): ChartEvent chartEvent = songObject as ChartEvent; saveString.AppendFormat(s_chartEventFormat, chartEvent.eventName); break; case (SongObject.ID.Starpower): Starpower sp = songObject as Starpower; saveString.AppendFormat(s_starpowerFormat, (uint)Mathf.Round(sp.length * resolutionScaleRatio)); break; case (SongObject.ID.Note): Note note = songObject as Note; int fretNumber; if (instrument != Song.Instrument.Unrecognised) { if (instrument == Song.Instrument.Drums) { fretNumber = GetDrumsSaveNoteNumber(note); } else if (instrument == Song.Instrument.GHLiveGuitar || instrument == Song.Instrument.GHLiveBass) { fretNumber = GetGHLSaveNoteNumber(note); } else { fretNumber = GetStandardSaveNoteNumber(note); } } else { fretNumber = note.rawNote; } saveString.AppendFormat(s_noteFormat, fretNumber, (uint)Mathf.Round(note.length * resolutionScaleRatio)); // Only need to get the flags of one note of a chord if (exportOptions.forced && (note.next == null || (note.next != null && note.next.tick != note.tick))) { if ((note.flags & Note.Flags.Forced) == Note.Flags.Forced) { saveString.AppendFormat(s_forcedNoteFormat, tick); } // Save taps line if not an open note, as open note taps cause weird artifacts under sp if (!note.IsOpenNote() && (note.flags & Note.Flags.Tap) == Note.Flags.Tap) { saveString.AppendFormat(s_tapNoteFormat, tick); } } continue; default: continue; } saveString.Append(Globals.LINE_ENDING); //throw new System.Exception("Test error count: " + i); } catch (System.Exception e) { string error = Logger.LogException(e, "Error with saving object #" + i + " as " + songObject); out_errorList += error + Globals.LINE_ENDING; } } return(saveString.ToString()); }
private static void ReadNotes(IList <MidiEvent> track, Song song, Song.Instrument instrument) { List <NoteOnEvent> forceNotesList = new List <NoteOnEvent>(); List <NoteOnEvent> proDrumsNotesList = new List <NoteOnEvent>(); List <SysexEvent> tapAndOpenEvents = new List <SysexEvent>(); Chart unrecognised = new Chart(song, Song.Instrument.Unrecognised); Chart.GameMode gameMode = Song.InstumentToChartGameMode(instrument); if (instrument == Song.Instrument.Unrecognised) { song.unrecognisedCharts.Add(unrecognised); } int rbSustainFixLength = (int)(64 * song.resolution / SongConfig.STANDARD_BEAT_RESOLUTION); // Load all the notes for (int i = 0; i < track.Count; i++) { var text = track[i] as TextEvent; if (text != null) { if (i == 0) { if (instrument == Song.Instrument.Unrecognised) { unrecognised.name = text.Text; } continue; // We don't want the first event because that is the name of the track } var tick = (uint)text.AbsoluteTime; var eventName = text.Text.Trim(new char[] { '[', ']' }); ChartEvent chartEvent = new ChartEvent(tick, eventName); if (instrument == Song.Instrument.Unrecognised) { unrecognised.Add(chartEvent); } else { song.GetChart(instrument, Song.Difficulty.Expert).Add(chartEvent); } } var note = track[i] as NoteOnEvent; if (note != null && note.OffEvent != null) { Song.Difficulty difficulty; var tick = (uint)note.AbsoluteTime; var sus = (uint)(note.OffEvent.AbsoluteTime - tick); if (instrument == Song.Instrument.Unrecognised) { int rawNote = SelectRawNoteValue(note.NoteNumber); Note newNote = new Note(tick, rawNote, sus); //difficulty = SelectRawNoteDifficulty(note.NoteNumber); unrecognised.Add(newNote); continue; } // Check if starpower event if (note.NoteNumber == MidIOHelper.STARPOWER_NOTE) { foreach (Song.Difficulty diff in EnumX <Song.Difficulty> .Values) { song.GetChart(instrument, diff).Add(new Starpower(tick, sus), false); } continue; } if (note.NoteNumber == MidIOHelper.SOLO_NOTE) { foreach (Song.Difficulty diff in EnumX <Song.Difficulty> .Values) { Chart chart = song.GetChart(instrument, diff); chart.Add(new ChartEvent(tick, MidIOHelper.SoloEventText)); chart.Add(new ChartEvent(tick + sus, MidIOHelper.SoloEndEventText)); } continue; } if (gameMode == Chart.GameMode.Drums) { Note.DrumPad dummy; if (MidIOHelper.CYMBAL_TO_PAD_LOOKUP.TryGetValue(note.NoteNumber, out dummy)) { // Cymbals toggles proDrumsNotesList.Add(note); continue; } } // Determine which difficulty we are manipulating try { if (gameMode == Chart.GameMode.GHLGuitar) { difficulty = SelectGHLNoteDifficulty(note.NoteNumber); } else { difficulty = SelectNoteDifficulty(note.NoteNumber); } } catch { continue; } // Check if we're reading a forcing event instead of a regular note if (gameMode != Chart.GameMode.Drums) { switch (note.NoteNumber) { case 65: case 66: case 77: case 78: case 89: case 90: case 101: case 102: forceNotesList.Add(note); // Store the event for later processing and continue continue; default: break; } } int fret; if (sus <= rbSustainFixLength) { sus = 0; } Note.Flags flags = Note.Flags.None; if (gameMode == Chart.GameMode.Drums) { fret = (int)GetDrumFretType(note.NoteNumber); int cymbalToggleId; if (MidIOHelper.PAD_TO_CYMBAL_LOOKUP.TryGetValue((Note.DrumPad)fret, out cymbalToggleId)) { flags |= Note.Flags.ProDrums_Cymbal; } } else if (gameMode == Chart.GameMode.GHLGuitar) { fret = (int)GetGHLFretType(note.NoteNumber); } else { fret = (int)GetStandardFretType(note.NoteNumber); } { // Add the note to the correct chart Note newNote = new Note(tick, fret, sus, flags); song.GetChart(instrument, difficulty).Add(newNote, false); } } var sysexEvent = track[i] as SysexEvent; if (sysexEvent != null) { tapAndOpenEvents.Add(sysexEvent); } } // Update all chart arrays if (instrument != Song.Instrument.Unrecognised) { foreach (Song.Difficulty diff in EnumX <Song.Difficulty> .Values) { song.GetChart(instrument, diff).UpdateCache(); } } else { unrecognised.UpdateCache(); } // Apply tap and open note events Chart[] chartsOfInstrument; if (instrument == Song.Instrument.Unrecognised) { chartsOfInstrument = new Chart[] { unrecognised }; } else { chartsOfInstrument = new Chart[EnumX <Song.Difficulty> .Count]; int difficultyCount = 0; foreach (Song.Difficulty difficulty in EnumX <Song.Difficulty> .Values) { chartsOfInstrument[difficultyCount++] = song.GetChart(instrument, difficulty); } } for (int i = 0; i < tapAndOpenEvents.Count; ++i) { var se1 = tapAndOpenEvents[i]; byte[] bytes = se1.GetData(); // Check for tap event if (bytes.Length == 8 && bytes[5] == 255 && bytes[7] == 1) { // Identified a tap section // 8 total bytes, 5th byte is FF, 7th is 1 to start, 0 to end uint tick = (uint)se1.AbsoluteTime; uint endPos = 0; // Find the end of the tap section for (int j = i; j < tapAndOpenEvents.Count; ++j) { var se2 = tapAndOpenEvents[j]; var bytes2 = se2.GetData(); /// Check for tap section end if (bytes2.Length == 8 && bytes2[5] == 255 && bytes2[7] == 0) { endPos = (uint)(se2.AbsoluteTime - tick); if (endPos > 0) { --endPos; } break; } } // Apply tap property foreach (Chart chart in chartsOfInstrument) { int index, length; SongObjectHelper.GetRange(chart.notes, tick, tick + endPos, out index, out length); for (int k = index; k < index + length; ++k) { chart.notes[k].SetType(Note.NoteType.Tap); } } } // Check for open notes // 5th byte determines the difficulty to apply to else if (bytes.Length == 8 && bytes[5] >= 0 && bytes[5] < 4 && bytes[7] == 1) { uint tick = (uint)se1.AbsoluteTime; Song.Difficulty difficulty; switch (bytes[5]) { case 0: difficulty = Song.Difficulty.Easy; break; case 1: difficulty = Song.Difficulty.Medium; break; case 2: difficulty = Song.Difficulty.Hard; break; case 3: difficulty = Song.Difficulty.Expert; break; default: continue; } uint endPos = 0; for (int j = i; j < tapAndOpenEvents.Count; ++j) { var se2 = tapAndOpenEvents[j] as SysexEvent; if (se2 != null) { var b2 = se2.GetData(); if (b2.Length == 8 && b2[5] == bytes[5] && b2[7] == 0) { endPos = (uint)(se2.AbsoluteTime - tick); if (endPos > 0) { --endPos; } break; } } } int index, length; SongObjectCache <Note> notes; if (instrument == Song.Instrument.Unrecognised) { notes = unrecognised.notes; } else { notes = song.GetChart(instrument, difficulty).notes; } SongObjectHelper.GetRange(notes, tick, tick + endPos, out index, out length); for (int k = index; k < index + length; ++k) { notes[k].guitarFret = Note.GuitarFret.Open; if (gameMode == Chart.GameMode.Drums) { notes[k].guitarFret = NoteFunctions.LoadDrumNoteToGuitarNote(notes[k].guitarFret); } } } } // Apply forcing events foreach (NoteOnEvent flagEvent in forceNotesList) { uint tick = (uint)flagEvent.AbsoluteTime; uint endPos = (uint)(flagEvent.OffEvent.AbsoluteTime - tick); Song.Difficulty difficulty; // Determine which difficulty we are manipulating try { difficulty = SelectNoteDifficulty(flagEvent.NoteNumber); } catch { continue; } Chart chart; if (instrument != Song.Instrument.Unrecognised) { chart = song.GetChart(instrument, difficulty); } else { chart = unrecognised; } int index, length; SongObjectHelper.GetRange(chart.notes, tick, tick + endPos, out index, out length); for (int i = index; i < index + length; ++i) { if ((chart.notes[i].flags & Note.Flags.Tap) != 0) { continue; } // if NoteNumber is odd force hopo, if even force strum if (flagEvent.NoteNumber % 2 != 0) { chart.notes[i].SetType(Note.NoteType.Hopo); } else { chart.notes[i].SetType(Note.NoteType.Strum); } } } foreach (var flagEvent in proDrumsNotesList) { uint tick = (uint)flagEvent.AbsoluteTime; uint endPos = (uint)(flagEvent.OffEvent.AbsoluteTime - tick); if (endPos > 0) { --endPos; } Debug.Assert(instrument == Song.Instrument.Drums); foreach (Song.Difficulty difficulty in EnumX <Song.Difficulty> .Values) { Chart chart = song.GetChart(instrument, difficulty); int index, length; SongObjectHelper.GetRange(chart.notes, tick, tick + endPos, out index, out length); Note.DrumPad drumPadForFlag; if (!MidIOHelper.CYMBAL_TO_PAD_LOOKUP.TryGetValue(flagEvent.NoteNumber, out drumPadForFlag)) { Debug.Assert(false, "Unknown note number flag " + flagEvent.NoteNumber); continue; } for (int i = index; i < index + length; ++i) { Note note = chart.notes[i]; if (note.drumPad == drumPadForFlag) { // Reverse cymbal flag note.flags ^= Note.Flags.ProDrums_Cymbal; } } } } }
public Chart(Song song, Song.Instrument instrument, string name = "") : this(song, Song.InstumentToChartGameMode(instrument), name) { }
static void ProcessTrackComponentLine(string line, Chart chart, Song.Instrument instrument, List <NoteFlag> flagsList) { int stringViewIndex = 0; uint position = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); // Skip over the equals sign char type = line[stringViewIndex]; HackyStringViewFunctions.AdvanceChartLineStringView(line, ref stringViewIndex); switch (type) { case 'N': { int noteNumber = (int)HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); uint length = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); switch (instrument) { case Song.Instrument.GHLiveGuitar: case Song.Instrument.GHLiveBass: LoadGHLiveNote(chart, position, noteNumber, length, flagsList); break; case Song.Instrument.Drums: LoadDrumNote(chart, position, noteNumber, length); break; case Song.Instrument.Guitar: case Song.Instrument.GuitarCoop: case Song.Instrument.Rhythm: case Song.Instrument.Bass: case Song.Instrument.Keys: LoadStandardNote(chart, position, noteNumber, length, flagsList); break; default: // Unrecognised Note newNote = new Note(position, noteNumber, length); chart.Add(newNote, false); break; } } break; case 'S': { int specialNumber = (int)HackyStringViewFunctions.AdvanceStringToUInt(line, ref stringViewIndex); uint length = HackyStringViewFunctions.GetNextTick(line, ref stringViewIndex); if (specialNumber == 2) { chart.Add(new Starpower(position, length), false); } } break; case 'E': { string eventName = HackyStringViewFunctions.GetNextTextUpToQuote(line, ref stringViewIndex); chart.Add(new ChartEvent(position, eventName), false); } break; default: break; } }
static SortableBytes[] GetChartSortableBytes(Song song, Song.Instrument instrument, Song.Difficulty difficulty, ExportOptions exportOptions) { Chart chart = song.GetChart(instrument, difficulty); Chart.GameMode gameMode = chart.gameMode; if (exportOptions.copyDownEmptyDifficulty) { Song.Difficulty chartDiff = difficulty; while (chart.notes.Count <= 0) { switch (chartDiff) { case (Song.Difficulty.Easy): chartDiff = Song.Difficulty.Medium; break; case (Song.Difficulty.Medium): chartDiff = Song.Difficulty.Hard; break; case (Song.Difficulty.Hard): chartDiff = Song.Difficulty.Expert; break; case (Song.Difficulty.Expert): default: return(new SortableBytes[0]); } chart = song.GetChart(instrument, chartDiff); } } List <SortableBytes> eventList = new List <SortableBytes>(); del InsertionSort = (sortableByte) => { int index = eventList.Count - 1; while (index >= 0 && sortableByte.tick < eventList[index].tick) { --index; } eventList.Insert(index + 1, sortableByte); }; foreach (ChartObject chartObject in chart.chartObjects) { Note note = chartObject as Note; SortableBytes onEvent = null; SortableBytes offEvent = null; if (note != null) { int noteNumber = GetMidiNoteNumber(note, gameMode, difficulty); GetNoteNumberBytes(noteNumber, note, out onEvent, out offEvent); if (exportOptions.forced) { // Forced notes if ((note.flags & Note.Flags.Forced) != 0 && note.type != Note.NoteType.Tap && (note.previous == null || (note.previous.tick != note.tick))) // Don't overlap on chords { // Add a note int difficultyNumber; int forcingOffset; if (!c_difficultyToMidiNoteWriteDict.TryGetValue(difficulty, out difficultyNumber)) { throw new Exception("Unhandled difficulty"); } if (!c_forcingMidiWriteOffsets.TryGetValue(note.type, out forcingOffset)) { throw new Exception("Unhandled note type found when trying to write forcing flag"); } int forcedNoteNumber = difficultyNumber + forcingOffset; SortableBytes forceOnEvent = new SortableBytes(note.tick, new byte[] { ON_EVENT, (byte)forcedNoteNumber, VELOCITY }); SortableBytes forceOffEvent = new SortableBytes(note.tick + 1, new byte[] { OFF_EVENT, (byte)forcedNoteNumber, VELOCITY }); InsertionSort(forceOnEvent); InsertionSort(forceOffEvent); } int openNote = gameMode == Chart.GameMode.GHLGuitar ? (int)Note.GHLiveGuitarFret.Open : (int)Note.GuitarFret.Open; // Add tap sysex events if (difficulty == Song.Difficulty.Expert && note.rawNote != openNote && (note.flags & Note.Flags.Tap) != 0 && (note.previous == null || (note.previous.flags & Note.Flags.Tap) == 0)) // This note is a tap while the previous one isn't as we're creating a range { // Find the next non-tap note Note nextNonTap = note; while (nextNonTap.next != null && nextNonTap.rawNote != openNote && (nextNonTap.next.flags & Note.Flags.Tap) != 0) { nextNonTap = nextNonTap.next; } // Tap event = 08-50-53-00-00-FF-04-01, end with 01 for On, 00 for Off byte[] tapOnEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, 0xFF, 0x04, SYSEX_ON, SYSEX_END }; byte[] tapOffEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, 0xFF, 0x04, SYSEX_OFF, SYSEX_END }; SortableBytes tapOnEvent = new SortableBytes(note.tick, tapOnEventBytes); SortableBytes tapOffEvent = new SortableBytes(nextNonTap.tick + 1, tapOffEventBytes); InsertionSort(tapOnEvent); InsertionSort(tapOffEvent); } } if (gameMode != Chart.GameMode.Drums && gameMode != Chart.GameMode.GHLGuitar && difficulty == Song.Difficulty.Expert && note.guitarFret == Note.GuitarFret.Open && (note.previous == null || (note.previous.guitarFret != Note.GuitarFret.Open))) { // Find the next non-open note Note nextNonOpen = note; while (nextNonOpen.next != null && nextNonOpen.next.guitarFret == Note.GuitarFret.Open) { nextNonOpen = nextNonOpen.next; } byte diff; switch (difficulty) { case (Song.Difficulty.Easy): diff = 0; break; case (Song.Difficulty.Medium): diff = 1; break; case (Song.Difficulty.Hard): diff = 2; break; case (Song.Difficulty.Expert): diff = 3; break; default: continue; } byte[] openOnEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, diff, 0x01, SYSEX_ON, SYSEX_END }; byte[] openOffEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, diff, 0x01, SYSEX_OFF, SYSEX_END }; SortableBytes openOnEvent = new SortableBytes(note.tick, openOnEventBytes); SortableBytes openOffEvent = new SortableBytes(nextNonOpen.tick + 1, openOffEventBytes); InsertionSort(openOnEvent); InsertionSort(openOffEvent); } } Starpower sp = chartObject as Starpower; if (sp != null && difficulty == Song.Difficulty.Expert) // Starpower cannot be split up between charts in a midi file { GetStarpowerBytes(sp, out onEvent, out offEvent); } ChartEvent chartEvent = chartObject as ChartEvent; if (chartEvent != null && difficulty == Song.Difficulty.Expert) // Text events cannot be split up in the file { InsertionSort(GetChartEventBytes(chartEvent)); } if (onEvent != null && offEvent != null) { InsertionSort(onEvent); if (offEvent.tick == onEvent.tick) { ++offEvent.tick; } InsertionSort(offEvent); } } return(eventList.ToArray()); }
public static void LoadChart(Chart chart, string[] data, Song.Instrument instrument = Song.Instrument.Guitar) { #if TIMING_DEBUG float time = Time.realtimeSinceStartup; #endif List <NoteFlag> flags = new List <NoteFlag>(); chart.SetCapacity(data.Length); const int SPLIT_POSITION = 0; const int SPLIT_EQUALITY = 1; const int SPLIT_TYPE = 2; const int SPLIT_VALUE = 3; const int SPLIT_LENGTH = 4; try { // Load notes, collect flags foreach (string line in data) { try { string[] splitString = line.Split(' '); uint tick = uint.Parse(splitString[SPLIT_POSITION]); string type = splitString[SPLIT_TYPE].ToLower(); switch (type) { case ("n"): // Split string to get note information string[] digits = splitString; int fret_type = int.Parse(digits[SPLIT_VALUE]); uint length = uint.Parse(digits[SPLIT_LENGTH]); if (instrument == Song.Instrument.Unrecognised) { Note newNote = new Note(tick, fret_type, length); chart.Add(newNote, false); } else if (instrument == Song.Instrument.Drums) { LoadDrumNote(chart, tick, fret_type, length); } else if (instrument == Song.Instrument.GHLiveGuitar || instrument == Song.Instrument.GHLiveBass) { LoadGHLiveNote(chart, tick, fret_type, length, flags); } else { LoadStandardNote(chart, tick, fret_type, length, flags); } break; case ("s"): fret_type = int.Parse(splitString[SPLIT_VALUE]); if (fret_type != 2) { continue; } length = uint.Parse(splitString[SPLIT_LENGTH]); chart.Add(new Starpower(tick, length), false); break; case ("e"): string[] strings = splitString; string eventName = strings[SPLIT_VALUE]; chart.Add(new ChartEvent(tick, eventName), false); break; default: break; } } catch (System.Exception e) { Logger.LogException(e, "Error parsing chart reader line \"" + line); } } chart.UpdateCache(); // Load flags foreach (NoteFlag flag in flags) { int index, length; SongObjectHelper.FindObjectsAtPosition(flag.tick, chart.notes, out index, out length); if (length > 0) { NoteFunctions.GroupAddFlags(chart.notes, flag.flag, index, length); } } #if TIMING_DEBUG Debug.Log("Chart load time: " + (Time.realtimeSinceStartup - time)); #endif } catch (System.Exception e) { // Bad load, most likely a parsing error Logger.LogException(e, "Error parsing chart reader chart data"); chart.Clear(); } }
/************************************************************************************* * Chart Loading **************************************************************************************/ public static void LoadChart(Chart chart, List <string> data, Song.Instrument instrument = Song.Instrument.Guitar) { LoadChart(chart, data.ToArray(), instrument); }
public static void LoadChart(Chart chart, string[] data, Song.Instrument instrument = Song.Instrument.Guitar) { #if TIMING_DEBUG float time = Time.realtimeSinceStartup; #endif List <NoteFlag> flags = new List <NoteFlag>(); chart.SetCapacity(data.Length); const int SPLIT_POSITION = 0; const int SPLIT_EQUALITY = 1; const int SPLIT_TYPE = 2; const int SPLIT_VALUE = 3; const int SPLIT_LENGTH = 4; try { // Load notes, collect flags foreach (string line in data) { try { string[] splitString = line.Split(' '); uint tick = uint.Parse(splitString[SPLIT_POSITION]); string type = splitString[SPLIT_TYPE].ToLower(); switch (type) { case ("n"): // Split string to get note information string[] digits = splitString; int fret_type = int.Parse(digits[SPLIT_VALUE]); uint length = uint.Parse(digits[SPLIT_LENGTH]); if (instrument == Song.Instrument.Unrecognised) { Note newNote = new Note(tick, fret_type, length); chart.Add(newNote, false); } else if (instrument == Song.Instrument.Drums) { LoadDrumNote(chart, tick, fret_type, length, flags); } else if (instrument == Song.Instrument.GHLiveGuitar || instrument == Song.Instrument.GHLiveBass) { LoadGHLiveNote(chart, tick, fret_type, length, flags); } else { LoadStandardNote(chart, tick, fret_type, length, flags); } break; case ("s"): fret_type = int.Parse(splitString[SPLIT_VALUE]); if (fret_type != 2) { continue; } length = uint.Parse(splitString[SPLIT_LENGTH]); chart.Add(new Starpower(tick, length), false); break; case ("e"): string[] strings = splitString; string eventName = strings[SPLIT_VALUE]; chart.Add(new ChartEvent(tick, eventName), false); break; default: break; } } catch (System.Exception e) { Logger.LogException(e, "Error parsing chart reader line \"" + line); } } chart.UpdateCache(); // Load flags foreach (NoteFlag flag in flags) { if (flag.flag == Note.Flags.ProDrums_Cymbal) { // The note number indicates which note it should attach to int noteNumber = flag.noteNumber - ChartIOHelper.c_proDrumsOffset; Debug.Assert(noteNumber >= 0, "Incorrectly parsed a note flag as a pro-drums flag. Note number was " + flag.noteNumber); int index, length; SongObjectHelper.FindObjectsAtPosition(flag.tick, chart.notes, out index, out length); if (length > 0) { for (int i = index; i < index + length; ++i) { Note note = chart.notes[i]; int saveNoteNum; if (!ChartIOHelper.c_drumNoteToSaveNumberLookup.TryGetValue(note.rawNote, out saveNoteNum)) { continue; } if (noteNumber == saveNoteNum) { // Reverse cymbal flag note.flags ^= Note.Flags.ProDrums_Cymbal; } } } } else { int index, length; SongObjectHelper.FindObjectsAtPosition(flag.tick, chart.notes, out index, out length); if (length > 0) { NoteFunctions.GroupAddFlags(chart.notes, flag.flag, index, length); } } } #if TIMING_DEBUG Debug.Log("Chart load time: " + (Time.realtimeSinceStartup - time)); #endif } catch (System.Exception e) { // Bad load, most likely a parsing error Logger.LogException(e, "Error parsing chart reader chart data"); chart.Clear(); } }
void SetInstrumentToggle(Toggle toggle, Song.Instrument instrument) { toggle.isOn = ChartEditor.Instance.currentInstrument == instrument; }
static SortableBytes[] GetChartSortableBytes(Song song, Song.Instrument instrument, Song.Difficulty difficulty, ExportOptions exportOptions) { Chart chart = song.GetChart(instrument, difficulty); Chart.GameMode gameMode = chart.gameMode; if (exportOptions.copyDownEmptyDifficulty) { Song.Difficulty chartDiff = difficulty; while (chart.notes.Count <= 0) { switch (chartDiff) { case (Song.Difficulty.Easy): chartDiff = Song.Difficulty.Medium; break; case (Song.Difficulty.Medium): chartDiff = Song.Difficulty.Hard; break; case (Song.Difficulty.Hard): chartDiff = Song.Difficulty.Expert; break; case (Song.Difficulty.Expert): default: return(new SortableBytes[0]); } chart = song.GetChart(instrument, chartDiff); } } List <SortableBytes> eventList = new List <SortableBytes>(); ChartEvent soloOnEvent = null; foreach (ChartObject chartObject in chart.chartObjects) { Note note = chartObject as Note; SortableBytes onEvent = null; SortableBytes offEvent = null; if (note != null) { int noteNumber = GetMidiNoteNumber(note, gameMode, difficulty); GetNoteNumberBytes(noteNumber, note, out onEvent, out offEvent); if (exportOptions.forced) { // Forced notes if ((note.flags & Note.Flags.Forced) != 0 && note.type != Note.NoteType.Tap && (note.previous == null || (note.previous.tick != note.tick))) // Don't overlap on chords { // Add a note int difficultyNumber; int forcingOffset; if (!c_difficultyToMidiNoteWriteDict.TryGetValue(difficulty, out difficultyNumber)) { throw new Exception("Unhandled difficulty"); } if (!c_forcingMidiWriteOffsets.TryGetValue(note.type, out forcingOffset)) { throw new Exception("Unhandled note type found when trying to write forcing flag"); } int forcedNoteNumber = difficultyNumber + forcingOffset; SortableBytes forceOnEvent = new SortableBytes(note.tick, new byte[] { ON_EVENT, (byte)forcedNoteNumber, VELOCITY }); SortableBytes forceOffEvent = new SortableBytes(note.tick + 1, new byte[] { OFF_EVENT, (byte)forcedNoteNumber, VELOCITY }); InsertionSort(eventList, forceOnEvent); InsertionSort(eventList, forceOffEvent); } if (instrument == Song.Instrument.Drums && ((note.flags & Note.Flags.ProDrums_Cymbal) == 0)) // We want to write our flags if the cymbal is toggled OFF, as these notes are cymbals by default { int tomToggleNoteNumber; if (MidIOHelper.PAD_TO_CYMBAL_LOOKUP.TryGetValue(note.drumPad, out tomToggleNoteNumber)) { SortableBytes tomToggleOnEvent = new SortableBytes(note.tick, new byte[] { ON_EVENT, (byte)tomToggleNoteNumber, VELOCITY }); SortableBytes tomToggleOffEvent = new SortableBytes(note.tick + 1, new byte[] { OFF_EVENT, (byte)tomToggleNoteNumber, VELOCITY }); InsertionSort(eventList, tomToggleOnEvent); InsertionSort(eventList, tomToggleOffEvent); } } int openNote = gameMode == Chart.GameMode.GHLGuitar ? (int)Note.GHLiveGuitarFret.Open : (int)Note.GuitarFret.Open; // Add tap sysex events if (difficulty == Song.Difficulty.Expert && note.rawNote != openNote && (note.flags & Note.Flags.Tap) != 0 && (note.previous == null || (note.previous.flags & Note.Flags.Tap) == 0)) // This note is a tap while the previous one isn't as we're creating a range { // Find the next non-tap note Note nextNonTap = note; while (nextNonTap.next != null && nextNonTap.rawNote != openNote && (nextNonTap.next.flags & Note.Flags.Tap) != 0) { nextNonTap = nextNonTap.next; } // Tap event = 08-50-53-00-00-FF-04-01, end with 01 for On, 00 for Off byte[] tapOnEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, 0xFF, 0x04, SYSEX_ON, SYSEX_END }; byte[] tapOffEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, 0xFF, 0x04, SYSEX_OFF, SYSEX_END }; SortableBytes tapOnEvent = new SortableBytes(note.tick, tapOnEventBytes); SortableBytes tapOffEvent = new SortableBytes(nextNonTap.tick + 1, tapOffEventBytes); InsertionSort(eventList, tapOnEvent); InsertionSort(eventList, tapOffEvent); } } if (gameMode != Chart.GameMode.Drums && gameMode != Chart.GameMode.GHLGuitar && difficulty == Song.Difficulty.Expert && note.guitarFret == Note.GuitarFret.Open && (note.previous == null || (note.previous.guitarFret != Note.GuitarFret.Open))) { // Find the next non-open note Note nextNonOpen = note; while (nextNonOpen.next != null && nextNonOpen.next.guitarFret == Note.GuitarFret.Open) { nextNonOpen = nextNonOpen.next; } byte diff; switch (difficulty) { case (Song.Difficulty.Easy): diff = 0; break; case (Song.Difficulty.Medium): diff = 1; break; case (Song.Difficulty.Hard): diff = 2; break; case (Song.Difficulty.Expert): diff = 3; break; default: continue; } byte[] openOnEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, diff, 0x01, SYSEX_ON, SYSEX_END }; byte[] openOffEventBytes = new byte[] { SYSEX_START, 0x08, 0x50, 0x53, 0x00, 0x00, diff, 0x01, SYSEX_OFF, SYSEX_END }; SortableBytes openOnEvent = new SortableBytes(note.tick, openOnEventBytes); SortableBytes openOffEvent = new SortableBytes(nextNonOpen.tick + 1, openOffEventBytes); InsertionSort(eventList, openOnEvent); InsertionSort(eventList, openOffEvent); } } Starpower sp = chartObject as Starpower; if (sp != null && difficulty == Song.Difficulty.Expert) // Starpower cannot be split up between charts in a midi file { GetStarpowerBytes(sp, out onEvent, out offEvent); } ChartEvent chartEvent = chartObject as ChartEvent; if (chartEvent != null && difficulty == Song.Difficulty.Expert) // Text events cannot be split up in the file { if (soloOnEvent != null && chartEvent.eventName == MidIOHelper.SoloEndEventText) { GetSoloBytes(soloOnEvent, chartEvent.tick, out onEvent, out offEvent); soloOnEvent = null; } else if (chartEvent.eventName == MidIOHelper.SoloEventText) { soloOnEvent = chartEvent; } else { InsertionSort(eventList, GetChartEventBytes(chartEvent)); } } if (onEvent != null && offEvent != null) { InsertionSort(eventList, onEvent); if (offEvent.tick == onEvent.tick) { ++offEvent.tick; } InsertionSort(eventList, offEvent); } } if (soloOnEvent != null) // Found a solo event with no end. Assume the solo lasts for the rest of the song { SortableBytes onEvent = null; SortableBytes offEvent = null; uint soloEndTick = chart.chartObjects[chart.chartObjects.Count - 1].tick; // In order to get a solo event the chart objects needed to have some object in this container, no need to check size, hopefully... GetSoloBytes(soloOnEvent, soloEndTick, out onEvent, out offEvent); if (onEvent != null && offEvent != null) { InsertionSort(eventList, onEvent); if (offEvent.tick == onEvent.tick) { ++offEvent.tick; } InsertionSort(eventList, offEvent); } } return(eventList.ToArray()); }
// 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; } } }