1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

Use TrackManager CreateWaveform to fix editor crashes

This commit is contained in:
Shane Woolcock 2019-01-08 17:04:43 +10:30
parent a267a1a085
commit 19693c3e51
4 changed files with 13 additions and 9 deletions

View File

@ -15,6 +15,7 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK.Graphics;
using osu.Framework.Audio;
namespace osu.Game.Tests.Visual
{
@ -30,9 +31,9 @@ namespace osu.Game.Tests.Visual
};
[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audioManager)
{
Beatmap.Value = new WaveformTestBeatmap();
Beatmap.Value = new WaveformTestBeatmap(audioManager.Track);
Children = new Drawable[]
{

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;
using osu.Framework.Audio;
namespace osu.Game.Tests.Visual
{
@ -17,9 +18,9 @@ namespace osu.Game.Tests.Visual
public class TestCaseWaveform : OsuTestCase
{
[BackgroundDependencyLoader]
private void load()
private void load(AudioManager audioManager)
{
Beatmap.Value = new WaveformTestBeatmap();
Beatmap.Value = new WaveformTestBeatmap(audioManager.Track);
FillFlowContainer flow;
Child = flow = new FillFlowContainer

View File

@ -19,10 +19,12 @@ namespace osu.Game.Tests
{
private readonly ZipArchiveReader reader;
private readonly FileStream stream;
private readonly TrackManager trackManager;
public WaveformTestBeatmap()
public WaveformTestBeatmap(TrackManager trackManager)
: base(new BeatmapInfo())
{
this.trackManager = trackManager;
stream = File.OpenRead(ImportBeatmapTest.TEST_OSZ_PATH);
reader = new ZipArchiveReader(stream);
}
@ -38,9 +40,9 @@ namespace osu.Game.Tests
protected override Texture GetBackground() => null;
protected override Waveform GetWaveform() => new Waveform(getAudioStream());
protected override Waveform GetWaveform() => trackManager.CreateWaveform(getAudioStream());
protected override Track GetTrack() => new TrackBass(getAudioStream());
protected override Track GetTrack() => trackManager.CreateTrack(getAudioStream());
private Stream getAudioStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".mp3")));
private Stream getBeatmapStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu")));

View File

@ -70,7 +70,7 @@ namespace osu.Game.Beatmaps
try
{
var trackData = store.GetStream(getPathForFile(Metadata.AudioFile));
return trackData == null ? null : trackManager.CreateTrack(trackData, false);
return trackData == null ? null : trackManager.CreateTrack(trackData);
}
catch
{
@ -91,7 +91,7 @@ namespace osu.Game.Beatmaps
try
{
var trackData = store.GetStream(getPathForFile(Metadata.AudioFile));
return trackData == null ? null : new Waveform(trackData);
return trackData == null ? null : trackManager.CreateWaveform(trackData);
}
catch
{