3
3
4
4
using osu . Framework . Allocation ;
5
5
using osu . Framework . Audio ;
6
- using osu . Framework . Audio . Track ;
7
6
using osu . Framework . Bindables ;
8
7
using osu . Framework . Extensions . IEnumerableExtensions ;
9
8
using osu . Framework . Graphics ;
@@ -19,9 +18,11 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Content.Compose
19
18
20
19
public partial class PlaybackSwitchButton : CompositeDrawable
21
20
{
22
- private readonly IBindable < Track > track = new Bindable < Track > ( ) ;
23
21
private readonly BindableNumber < double > freqAdjust = new BindableDouble ( 1 ) ;
24
22
23
+ [ Resolved ]
24
+ private EditorClock editorClock { get ; set ; } = null ! ;
25
+
25
26
public PlaybackSwitchButton ( )
26
27
{
27
28
Height = SpecialActionToolbar . HEIGHT ;
@@ -32,26 +33,18 @@ public PlaybackSwitchButton()
32
33
Origin = Anchor . Centre ,
33
34
Current = freqAdjust ,
34
35
} ;
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
- } ) ;
44
36
}
45
37
46
- [ BackgroundDependencyLoader ]
47
- private void load ( EditorClock clock )
38
+ protected override void LoadComplete ( )
48
39
{
49
- track . BindTo ( clock . Track ) ;
40
+ base . LoadComplete ( ) ;
41
+
42
+ editorClock . AudioAdjustments . AddAdjustment ( AdjustableProperty . Frequency , freqAdjust ) ;
50
43
}
51
44
52
45
protected override void Dispose ( bool isDisposing )
53
46
{
54
- track . Value ? . RemoveAdjustment ( AdjustableProperty . Frequency , freqAdjust ) ;
47
+ editorClock . AudioAdjustments . RemoveAdjustment ( AdjustableProperty . Frequency , freqAdjust ) ;
55
48
56
49
base . Dispose ( isDisposing ) ;
57
50
}
0 commit comments