XMLDoc all the things

This commit is contained in:
smoogipoo 2018-06-21 18:54:42 +09:00
parent 40ed3fdd05
commit 63a6fc2596
2 changed files with 33 additions and 0 deletions

View File

@ -11,7 +11,14 @@ namespace osu.Game.Audio
{
public abstract class PreviewTrack : Component
{
/// <summary>
/// Invoked when this <see cref="PreviewTrack"/> has stopped playing.
/// </summary>
public event Action Stopped;
/// <summary>
/// Invoked when this <see cref="PreviewTrack"/> has started playing.
/// </summary>
public event Action Started;
private Track track;
@ -52,6 +59,9 @@ protected override void Update()
private ScheduledDelegate startDelegate;
/// <summary>
/// Starts playing this <see cref="PreviewTrack"/>.
/// </summary>
public void Start() => startDelegate = Schedule(() =>
{
if (!IsLoaded)
@ -68,6 +78,9 @@ public void Start() => startDelegate = Schedule(() =>
Started?.Invoke();
});
/// <summary>
/// Stops playing this <see cref="PreviewTrack"/>.
/// </summary>
public void Stop()
{
startDelegate?.Cancel();
@ -86,6 +99,9 @@ public void Stop()
Stopped?.Invoke();
}
/// <summary>
/// Retrieves the audio track.
/// </summary>
protected abstract Track GetTrack();
}
}

View File

@ -11,6 +11,9 @@
namespace osu.Game.Audio
{
/// <summary>
/// A central store for the retrieval of <see cref="PreviewTrack"/>s.
/// </summary>
public class PreviewTrackManager : Component
{
private readonly BindableDouble muteBindable = new BindableDouble();
@ -31,6 +34,11 @@ private void load(AudioManager audio, FrameworkConfigManager config)
config.BindWith(FrameworkSetting.VolumeMusic, trackManager.Volume);
}
/// <summary>
/// Retrieves a <see cref="PreviewTrack"/> for a <see cref="BeatmapSetInfo"/>.
/// </summary>
/// <param name="beatmapSetInfo">The <see cref="BeatmapSetInfo"/> to retrieve the preview track for.</param>
/// <returns>The playable <see cref="PreviewTrack"/>.</returns>
public PreviewTrack Get(BeatmapSetInfo beatmapSetInfo)
{
var track = new TrackManagerPreviewTrack(beatmapSetInfo, trackManager);
@ -51,6 +59,15 @@ public PreviewTrack Get(BeatmapSetInfo beatmapSetInfo)
return track;
}
/// <summary>
/// Stops the currently playing <see cref="PreviewTrack"/>.
/// </summary>
/// <remarks>
/// Only the immediate owner (an object that implements <see cref="IPreviewTrackOwner"/>) of the playing <see cref="PreviewTrack"/>
/// can globally stop the currently playing <see cref="PreviewTrack"/>. The object holding a reference to the <see cref="PreviewTrack"/>
/// can always stop the <see cref="PreviewTrack"/> themselves through <see cref="PreviewTrack.Stop()"/>.
/// </remarks>
/// <param name="source">The <see cref="IPreviewTrackOwner"/> which may be the owner of the <see cref="PreviewTrack"/>.</param>
public void Stop(IPreviewTrackOwner source)
{
if (current?.Owner != source)