private IEnumerable <ShowLight> GenerateBeamNotes(ArrangementData arrangement, List <ShowLight> currentShowlights) { var beamFunctions = new BeamGenerationFunctions(arrangement.MidiNotes, beamOptions.RandomizeColors); switch (beamOptions.GenerationMethod) { case BeamGenerationMethod.MinTimeBetweenChanges: return(beamFunctions.FromMinTime( currentShowlights, arrangement.Sections, beamOptions.MinTimeBetweenNotes, beamOptions.UseCompatibleColors)); case BeamGenerationMethod.FollowFogNotes: return(BeamGenerationFunctions.FromFogNotes(currentShowlights)); default: Debug.Print("ERROR: Unknown beam generation method."); return(Enumerable.Empty <ShowLight>()); } }
// Ensures that at least one note of the type is present and moves the first note to the start of the beatmap. private void ValidateFirstNoteOfType(List <ShowLight> showlights, ShowLightType showlightType) { int firstNoteIndex = showlights.FindIndex(sl => sl.GetShowLightType() == showlightType); if (firstNoteIndex == -1) { // Add new random note if not found showlights.Insert(0, new ShowLight(FirstBeatTime, showlightType == ShowLightType.Fog ? FogGenerationFunctions.GetRandomFogNote() : BeamGenerationFunctions.GetRandomBeamNote()) ); } else if (showlights[firstNoteIndex].Time != FirstBeatTime) { // Move first note to start of the beatmap showlights[firstNoteIndex] = new ShowLight(FirstBeatTime, showlights[firstNoteIndex].Note); } }