// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System.Collections.Generic; using System.IO; using System.Threading; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Skinning; using osu.Game.Storyboards; namespace osu.Game.Beatmaps { /// /// A more expensive representation of a beatmap which allows access to various associated resources. /// - Access textures and other resources via . /// - Access the storyboard via . /// - Access a local skin via . /// - Access the track via (and then for subsequent accesses). /// - Create a playable via . /// public interface IWorkingBeatmap { IBeatmapInfo BeatmapInfo { get; } /// /// Whether the Beatmap has finished loading. /// public bool BeatmapLoaded { get; } /// /// Whether the Track has finished loading. /// public bool TrackLoaded { get; } /// /// Retrieves the which this represents. /// IBeatmap Beatmap { get; } /// /// Retrieves the background for this . /// Texture Background { get; } /// /// Retrieves the for the of this . /// Waveform Waveform { get; } /// /// Retrieves the which this provides. /// Storyboard Storyboard { get; } /// /// Retrieves the which this provides. /// ISkin Skin { get; } /// /// Retrieves the which this has loaded. /// Track Track { get; } /// /// Constructs a playable from using the applicable converters for a specific . /// /// The returned is in a playable state - all and s /// have been applied, and s have been fully constructed. /// /// /// /// By default, the beatmap load process will be interrupted after 10 seconds. /// For finer-grained control over the load process, use the /// /// overload instead. /// /// The to create a playable for. /// The s to apply to the . /// The converted . /// If could not be converted to . IBeatmap GetPlayableBeatmap(IRulesetInfo ruleset, IReadOnlyList mods = null); /// /// Constructs a playable from using the applicable converters for a specific . /// /// The returned is in a playable state - all and s /// have been applied, and s have been fully constructed. /// /// /// The to create a playable for. /// The s to apply to the . /// Cancellation token that cancels the beatmap loading process. /// The converted . /// If could not be converted to . IBeatmap GetPlayableBeatmap(IRulesetInfo ruleset, IReadOnlyList mods, CancellationToken cancellationToken); /// /// Load a new audio track instance for this beatmap. This should be called once before accessing . /// The caller of this method is responsible for the lifetime of the track. /// /// /// In a standard game context, the loading of the track is managed solely by MusicController, which will /// automatically load the track of the current global IBindable IWorkingBeatmap. /// As such, this method should only be called in very special scenarios, such as external tests or apps which are /// outside of the game context. /// /// A fresh track instance, which will also be available via . Track LoadTrack(); /// /// Returns the stream of the file from the given storage path. /// /// The storage path to the file. Stream GetStream(string storagePath); /// /// Beings loading the contents of this asynchronously. /// public void BeginAsyncLoad(); /// /// Cancels the asynchronous loading of the contents of this . /// public void CancelAsyncLoad(); /// /// Reads the correct track restart point from beatmap metadata and sets looping to enabled. /// void PrepareTrackForPreviewLooping(); } }