2018-04-13 17:19:50 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using OpenTK;
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
2018-06-11 19:08:17 +08:00
|
|
|
using osu.Framework.Graphics.Audio;
|
2018-04-13 17:19:50 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class TestCaseWaveform : OsuTestCase
|
|
|
|
{
|
2018-05-23 16:37:39 +08:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
FillFlowContainer flow;
|
|
|
|
Child = flow = new FillFlowContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 10),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new MusicController
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Y = 100,
|
|
|
|
State = Visibility.Visible
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (int i = 1; i <= 16; i *= 2)
|
|
|
|
{
|
2018-06-11 19:08:17 +08:00
|
|
|
var newDisplay = new WaveformGraph
|
2018-04-13 17:19:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-05-23 16:37:39 +08:00
|
|
|
Resolution = 1f / i,
|
2018-04-13 17:19:50 +08:00
|
|
|
};
|
|
|
|
|
2018-06-11 19:08:17 +08:00
|
|
|
Beatmap.ValueChanged += b => newDisplay.Waveform = b.Waveform;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
flow.Add(new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 100,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
newDisplay,
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.Black,
|
|
|
|
Alpha = 0.75f
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Text = $"Resolution: {1f / i:0.00}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|