New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move beatmap track into MusicController #9792
Conversation
Mostly out of curiosity, what is the end goal here? This seems like a pretty drastic change in direction. |
The goal is to have a dedicated owner of the track, rather than it being referenced/potentially created by everything in the game. One immediate use for this is to fade between tracks at song select, which is a 2-liner now that |
Are you talking about the |
Yeah, that was the one. |
I've reverted that usage too. I thought it made sense to leave it as |
I don't think I have any issues left with this any more, and I've also briefly play-tested this branch and had nothing funny happen, so going to throw in a tentative approve. Should get a second pair of eyes on this before merging though (hi @smoogipoo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned in discord, I'm really not sure I like these.
Components that use both the beatmap and the track should outright crash if the track isn't loaded, rather than silently using the music controller's (wrong) track.
Seems like #9843 has broken this branch a bit. Since mods no longer preserve references, |
osu.Game/Screens/Play/Player.cs
Outdated
Beatmap.Value.Track.ResetSpeedAdjustments(); | ||
foreach (var mod in Mods.Value.OfType<IApplicableToTrack>()) | ||
mod.ApplyToTrack(Beatmap.Value.Track); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the failing tests, doing this causes the adjustment to get re-applied twice because of this:
MusicController.AllowRateAdjustments = true; |
Disabling this back again locally makes them pass, but this makes me quite uneasy... Maybe that true
override is no longer necessary with the recent changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would hope it's not needed.. but also hope that it didn't break anything.
@smoogipoo did you find the reason that was breaking things? kinda need some resolution there as it really shouldn't in my head. |
I haven't, but I can imagine why. I'm not super confident about this code |
That's correct, check the implementation of osu/osu.Game/Overlays/MusicController.cs Lines 335 to 348 in dda776d
|
ah......................... at very least let's add a mention to the xmldoc for |
I apologise for the size of this one. It's really hard to make such a change without touching almost every file in the game, which probably spells bad news for the reach of the (now)
MusicController
in general.Going forward this can probably be fixed on a per-case basis by either passing down the track or caching it locally at overarching components, which is probably a good idea in general for component isolation. I've already done this for
Player
because it felt wrong to DIMusicController
inGameplayClockContainer
andFailAnimation
.The idea of this PR is to define a single owner for the beatmap's track. Specifically, the track which plays the sound and which is stored as an on-going reference.
The goal is to eventually be able to fade between tracks when changed in song select, which needs both the single owner idea and for the track to be able to be placed in the draw hierarchy - it needs to also become a
DrawableTrack
.Changes of particular note
MusicController
.WorkingBeatmap
instances byBeatmapManager
and the disposal of the track store is now also handled by theBeatmapManager
.OsuGame
toMusicController
.MusicController
has been moved toOsuGameBase
. It is now loaded as part of the async procedure but before the game'sLoader
. I haven't fully assessed the performance impact of this since it was previously in aloadComponentSingleFile()
but it doesn't seem to have a noticeable impact when loading osu! from an external USB drive with ~1000 sets.MusicController
.Testing
Beyond the automated CI tests, I've also tested a whole bunch of scenarios, including: