2018-05-25 05:37:53 +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 System;
|
|
|
|
|
using osu.Framework.Audio.Track;
|
2018-06-02 02:06:37 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-05-25 05:37:53 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Audio
|
|
|
|
|
{
|
|
|
|
|
public class PreviewTrack
|
|
|
|
|
{
|
|
|
|
|
public readonly Track Track;
|
2018-06-02 02:06:37 +08:00
|
|
|
|
public readonly OverlayContainer Owner;
|
|
|
|
|
|
2018-05-25 05:37:53 +08:00
|
|
|
|
public event Action Stopped;
|
|
|
|
|
public event Action Started;
|
|
|
|
|
|
2018-06-02 02:36:30 +08:00
|
|
|
|
public PreviewTrack(Track track, OverlayContainer owner)
|
2018-05-25 05:37:53 +08:00
|
|
|
|
{
|
|
|
|
|
Track = track;
|
2018-06-02 02:06:37 +08:00
|
|
|
|
Owner = owner;
|
2018-05-25 05:37:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
Track.Restart();
|
|
|
|
|
Started?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
Track.Stop();
|
|
|
|
|
Stopped?.Invoke();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|