Skip to content

Commit a391384

Browse files
committed
Fix EditorClock.Track is removed.
see: https://github.com/ppy/osu/pull/31445/files
1 parent 0daa7d9 commit a391384

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/Toolbar/Playback/PlaybackSwitchButton.cs

+8-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
using osu.Framework.Allocation;
55
using osu.Framework.Audio;
6-
using osu.Framework.Audio.Track;
76
using osu.Framework.Bindables;
87
using osu.Framework.Extensions.IEnumerableExtensions;
98
using osu.Framework.Graphics;
@@ -19,9 +18,11 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Compose
1918

2019
public partial class PlaybackSwitchButton : CompositeDrawable
2120
{
22-
private readonly IBindable<Track> track = new Bindable<Track>();
2321
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
2422

23+
[Resolved]
24+
private EditorClock editorClock { get; set; } = null!;
25+
2526
public PlaybackSwitchButton()
2627
{
2728
Height = SpecialActionToolbar.HEIGHT;
@@ -32,26 +33,18 @@ public PlaybackSwitchButton()
3233
Origin = Anchor.Centre,
3334
Current = freqAdjust,
3435
};
35-
36-
track.BindValueChanged(tr =>
37-
{
38-
tr.OldValue?.RemoveAdjustment(AdjustableProperty.Frequency, freqAdjust);
39-
40-
// notice that it's not the same bindable as PlaybackControl because track can accept many bindable at the same time.
41-
// should have the better way to get the overall playback speed in the editor but it's OK for now.
42-
tr.NewValue?.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
43-
});
4436
}
4537

46-
[BackgroundDependencyLoader]
47-
private void load(EditorClock clock)
38+
protected override void LoadComplete()
4839
{
49-
track.BindTo(clock.Track);
40+
base.LoadComplete();
41+
42+
editorClock.AudioAdjustments.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
5043
}
5144

5245
protected override void Dispose(bool isDisposing)
5346
{
54-
track.Value?.RemoveAdjustment(AdjustableProperty.Frequency, freqAdjust);
47+
editorClock.AudioAdjustments.RemoveAdjustment(AdjustableProperty.Frequency, freqAdjust);
5548

5649
base.Dispose(isDisposing);
5750
}

0 commit comments

Comments
 (0)