Update the displayed BPM at song select with rate adjust mods

This only covers constant rate rate adjust mods. Mods like wind up/wind
down will need a more complex implementation which we haven't really
planned yet.
This commit is contained in:
Dean Herbert 2021-02-25 17:00:42 +09:00
parent a9aed0eef4
commit 31c52bd585
1 changed files with 10 additions and 2 deletions

View File

@ -383,10 +383,18 @@ private InfoLabel[] getInfoLabels()
return labels.ToArray();
}
[Resolved]
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
private string getBPMRange(IBeatmap beatmap)
{
double bpmMax = beatmap.ControlPointInfo.BPMMaximum;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum;
// this doesn't consider mods which apply variable rates, yet.
double rate = 1;
foreach (var mod in mods.Value.OfType<IApplicableToRate>())
rate = mod.ApplyToRate(0, rate);
double bpmMax = beatmap.ControlPointInfo.BPMMaximum * rate;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum * rate;
if (Precision.AlmostEquals(bpmMin, bpmMax))
return $"{bpmMin:0}";