1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-21 22:27:23 +08:00

Merge pull request #1658 from peppy/add-wait-for-restart

Wait until track has restarted before continuing operation
This commit is contained in:
Dan Balasescu 2017-12-05 14:24:25 +09:00 committed by GitHub
commit abf5f3b390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using System.Threading;
namespace osu.Game.Overlays.Music
{
@ -148,7 +149,15 @@ namespace osu.Game.Overlays.Music
private void playSpecified(BeatmapInfo info)
{
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
beatmapBacking.Value.Track.Restart();
var track = beatmapBacking.Value.Track;
track.Restart();
// this is temporary until we have blocking (async.Wait()) audio component methods.
// then we can call RestartAsync().Wait() or the blocking version above.
while (!track.IsRunning)
Thread.Sleep(1);
}
}