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:
commit
abf5f3b390
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user