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)); }
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)); }