Skip to content

Commit d8ba5c2

Browse files
committed
wip
1 parent 657a496 commit d8ba5c2

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

SampleGame/SampleGameGame.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,55 @@
77
using osuTK.Graphics;
88
using osu.Framework.Graphics.Shapes;
99
using osu.Framework.Allocation;
10+
using osu.Framework.Audio.Track;
11+
using osu.Framework.Graphics.Sprites;
12+
using osu.Framework.Input.Events;
1013

1114
namespace SampleGame
1215
{
1316
public partial class SampleGameGame : Game
1417
{
1518
private Box box = null!;
19+
private TrackBass bassTrack;
20+
private SpriteText text;
1621

1722
[BackgroundDependencyLoader]
1823
private void load()
1924
{
25+
bassTrack = (TrackBass)Dependencies.Get<ITrackStore>().Get("test.ogg");
26+
bassTrack.Start();
27+
2028
Add(box = new Box
2129
{
2230
Anchor = Anchor.Centre,
2331
Origin = Anchor.Centre,
2432
Size = new Vector2(150, 150),
2533
Colour = Color4.Tomato
2634
});
35+
36+
Add(text = new SpriteText()
37+
{
38+
Anchor = Anchor.Centre,
39+
Origin = Anchor.Centre,
40+
});
41+
}
42+
43+
protected override bool OnKeyDown(KeyDownEvent e)
44+
{
45+
bassTrack.Stop();
46+
bassTrack.Seek(200);
47+
bassTrack.Start();
48+
49+
return base.OnKeyDown(e);
2750
}
2851

2952
protected override void Update()
3053
{
3154
base.Update();
3255
box.Rotation += (float)Time.Elapsed / 10;
56+
57+
if (bassTrack.CurrentTime < 100)
58+
text.Text = bassTrack.CurrentTime.ToString();
3359
}
3460
}
3561
}

osu.Framework/Audio/Track/TrackBass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ private void updateCurrentTime()
335335
Debug.Assert(CanPerformInline);
336336

337337
long bytePosition = bassMixer.ChannelGetPosition(this);
338-
if (bytePosition != -1)
338+
// if (bytePosition != -1)
339339
Interlocked.Exchange(ref currentTime, Bass.ChannelBytes2Seconds(activeStream, bytePosition) * 1000);
340340
}
341341

4.15 MB
Binary file not shown.

0 commit comments

Comments
 (0)