public void SetCurrentBPM(double phraseNumber, double newBPM) { var key = BPMs.Keys.LastOrDefault(e => e <= phraseNumber); BPMs[key] = newBPM; _timingMap = SongTimingMap.CreateSongTimingMap(Stops, BPMs); }
public static SongTimingMap CreateSongTimingMap(Dictionary <double, double> stops, Dictionary <double, double> bpmChanges) { var result = new SongTimingMap(); var bpmKeys = bpmChanges.Keys.ToArray(); var stopKeys = stops.Keys.ToArray(); foreach (var bpmKey in bpmKeys) { result.TimingPoints.Add(new SongTimingPoint { Amount = bpmChanges[bpmKey], Phrase = bpmKey, PointType = PointType.BPM_CHANGE }); } foreach (var stopKey in stopKeys) { result.TimingPoints.Add(new SongTimingPoint { Amount = stops[stopKey], Phrase = stopKey, PointType = PointType.STOP }); } result.SortByPhrase(); result.CalculateMSTable(); //TODO: How much memory does this use? return(result); }