diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
index 27a341ffb7..f3255814f2 100644
--- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
+++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs
@@ -267,15 +267,18 @@ namespace osu.Game.Tests.Visual.SongSelect
for (int i = 0; i < 6; i++)
{
int beatmapId = setId * 10 + i;
+
int length = RNG.Next(30000, 200000);
+ double bpm = RNG.NextSingle(80, 200);
beatmaps.Add(new BeatmapInfo
{
Ruleset = getRuleset(),
OnlineBeatmapID = beatmapId,
Path = "normal.osu",
- Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss})",
+ Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})",
Length = length,
+ BPM = bpm,
BaseDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 3.5f,
@@ -283,7 +286,6 @@ namespace osu.Game.Tests.Visual.SongSelect
});
}
- double bpm = RNG.NextSingle(80, 200);
return new BeatmapSetInfo
{
OnlineBeatmapSetID = setId,
@@ -292,15 +294,11 @@ namespace osu.Game.Tests.Visual.SongSelect
{
// Create random metadata, then we can check if sorting works based on these
Artist = "Some Artist " + RNG.Next(0, 9),
- Title = $"Some Song (set id {setId}, bpm {bpm:0.#})",
+ Title = $"Some Song (set id {setId}, max bpm {beatmaps.Max(b => b.BPM):0.#})",
AuthorString = "Some Guy " + RNG.Next(0, 9),
},
Beatmaps = beatmaps,
DateAdded = DateTimeOffset.UtcNow,
- OnlineInfo = new BeatmapSetOnlineInfo
- {
- BPM = bpm,
- }
};
}
}
diff --git a/osu.Game.Tournament/Components/SongBar.cs b/osu.Game.Tournament/Components/SongBar.cs
index 938fbba303..ec021a8d1f 100644
--- a/osu.Game.Tournament/Components/SongBar.cs
+++ b/osu.Game.Tournament/Components/SongBar.cs
@@ -158,7 +158,7 @@ namespace osu.Game.Tournament.Components
return;
}
- var bpm = beatmap.BeatmapSet.BPM;
+ var bpm = beatmap.BeatmapSet.OnlineInfo.BPM;
var length = beatmap.Length;
string hardRockExtra = "";
string srExtra = "";
diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs
index 609f75461c..fa1282647e 100644
--- a/osu.Game/Beatmaps/BeatmapInfo.cs
+++ b/osu.Game/Beatmaps/BeatmapInfo.cs
@@ -56,6 +56,11 @@ namespace osu.Game.Beatmaps
///
public double Length { get; set; }
+ ///
+ /// The most common BPM of this beatmap.
+ ///
+ public double BPM { get; set; }
+
public string Path { get; set; }
[JsonProperty("file_sha2")]
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 34a8ddf5c9..56816607ee 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -271,11 +271,7 @@ namespace osu.Game.Beatmaps
OnlineBeatmapSetID = beatmap.BeatmapInfo.BeatmapSet?.OnlineBeatmapSetID,
Beatmaps = new List(),
Metadata = beatmap.Metadata,
- DateAdded = DateTimeOffset.UtcNow,
- OnlineInfo = new BeatmapSetOnlineInfo
- {
- BPM = beatmap.ControlPointInfo.BPMMode,
- }
+ DateAdded = DateTimeOffset.UtcNow
};
}
@@ -307,6 +303,7 @@ namespace osu.Game.Beatmaps
// TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0;
beatmap.BeatmapInfo.Length = beatmap.CalculateLength();
+ beatmap.BeatmapInfo.BPM = beatmap.ControlPointInfo.BPMMode;
beatmapInfos.Add(beatmap.BeatmapInfo);
}
diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs
index 3e6385bdd5..4075263e12 100644
--- a/osu.Game/Beatmaps/BeatmapSetInfo.cs
+++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs
@@ -45,6 +45,11 @@ namespace osu.Game.Beatmaps
///
public double MaxLength => Beatmaps?.Max(b => b.Length) ?? 0;
+ ///
+ /// The maximum BPM of all beatmaps in this set.
+ ///
+ public double MaxBPM => Beatmaps?.Max(b => b.BPM) ?? 0;
+
[NotMapped]
public bool DeletePending { get; set; }
diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
index 7934cf388f..5a3996bb49 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs
@@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
case SortMode.BPM:
- return BeatmapSet.OnlineInfo.BPM.CompareTo(otherSet.BeatmapSet.OnlineInfo.BPM);
+ return BeatmapSet.MaxBPM.CompareTo(otherSet.BeatmapSet.MaxBPM);
case SortMode.Length:
return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength);