2019-08-13 14:46:57 +09:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2019-01-24 17:43:03 +09:00
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
using System;
|
2018-05-14 17:41:35 +09:00
|
|
|
using System.Collections.Generic;
|
2018-04-13 18:19:50 +09:00
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
2020-07-10 16:33:31 +09:00
|
|
|
using osu.Framework.Audio.Track;
|
2019-02-21 19:04:31 +09:00
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 18:19:50 +09:00
|
|
|
using osu.Framework.Graphics;
|
2019-08-13 14:38:49 +09:00
|
|
|
using osu.Framework.Input.Bindings;
|
2020-01-09 13:43:44 +09:00
|
|
|
using osu.Framework.Utils;
|
2018-04-13 18:19:50 +09:00
|
|
|
using osu.Framework.Threading;
|
|
|
|
using osu.Game.Beatmaps;
|
2019-08-13 14:38:49 +09:00
|
|
|
using osu.Game.Input.Bindings;
|
|
|
|
using osu.Game.Overlays.OSD;
|
2019-04-08 19:16:34 +09:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Handles playback of the global music track.
|
|
|
|
/// </summary>
|
2019-08-13 14:38:49 +09:00
|
|
|
public class MusicController : Component, IKeyBindingHandler<GlobalAction>
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
[Resolved]
|
|
|
|
private BeatmapManager beatmaps { get; set; }
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2020-02-17 16:59:35 +09:00
|
|
|
public IBindableList<BeatmapSetInfo> BeatmapSets
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (LoadState < LoadState.Ready)
|
|
|
|
throw new InvalidOperationException($"{nameof(BeatmapSets)} should not be accessed before the music controller is loaded.");
|
|
|
|
|
|
|
|
return beatmapSets;
|
|
|
|
}
|
|
|
|
}
|
2019-09-18 13:14:33 +09:00
|
|
|
|
2019-10-24 13:10:17 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Point in time after which the current track will be restarted on triggering a "previous track" action.
|
|
|
|
/// </summary>
|
2019-10-11 16:41:54 +07:00
|
|
|
private const double restart_cutoff_point = 5000;
|
|
|
|
|
2019-09-18 13:14:33 +09:00
|
|
|
private readonly BindableList<BeatmapSetInfo> beatmapSets = new BindableList<BeatmapSetInfo>();
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-07-11 00:18:19 +09:00
|
|
|
public bool IsUserPaused { get; private set; }
|
2019-07-09 11:32:49 +02:00
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Fired when the global <see cref="WorkingBeatmap"/> has changed.
|
|
|
|
/// Includes direction information for display purposes.
|
|
|
|
/// </summary>
|
|
|
|
public event Action<WorkingBeatmap, TrackChangeDirection> TrackChanged;
|
|
|
|
|
2019-04-08 19:16:34 +09:00
|
|
|
[Resolved]
|
2019-08-13 14:29:58 +09:00
|
|
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
2019-04-08 19:16:34 +09:00
|
|
|
|
|
|
|
[Resolved]
|
2019-04-10 17:13:12 +09:00
|
|
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
2018-05-23 17:37:39 +09:00
|
|
|
|
2019-08-13 14:38:49 +09:00
|
|
|
[Resolved(canBeNull: true)]
|
|
|
|
private OnScreenDisplay onScreenDisplay { get; set; }
|
|
|
|
|
2020-05-27 16:08:47 +09:00
|
|
|
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
2020-05-19 16:44:22 +09:00
|
|
|
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
[BackgroundDependencyLoader]
|
2019-08-13 14:29:58 +09:00
|
|
|
private void load()
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2020-05-27 16:08:47 +09:00
|
|
|
managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
|
|
|
|
managerUpdated.BindValueChanged(beatmapUpdated);
|
2020-05-19 16:44:22 +09:00
|
|
|
managerRemoved = beatmaps.ItemRemoved.GetBoundCopy();
|
|
|
|
managerRemoved.BindValueChanged(beatmapRemoved);
|
2020-02-17 16:59:35 +09:00
|
|
|
|
2020-07-10 16:33:31 +09:00
|
|
|
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
|
2018-05-10 10:15:47 +02:00
|
|
|
}
|
|
|
|
|
2018-04-13 18:19:50 +09:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
2020-02-17 16:59:35 +09:00
|
|
|
base.LoadComplete();
|
|
|
|
|
2018-06-07 16:46:54 +09:00
|
|
|
beatmap.BindValueChanged(beatmapChanged, true);
|
2019-09-28 04:18:16 +03:00
|
|
|
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Change the position of a <see cref="BeatmapSetInfo"/> in the current playlist.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="beatmapSetInfo">The beatmap to move.</param>
|
|
|
|
/// <param name="index">The new position.</param>
|
|
|
|
public void ChangeBeatmapSetPosition(BeatmapSetInfo beatmapSetInfo, int index)
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2019-09-18 13:14:33 +09:00
|
|
|
beatmapSets.Remove(beatmapSetInfo);
|
|
|
|
beatmapSets.Insert(index, beatmapSetInfo);
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:38:49 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Returns whether the current beatmap track is playing.
|
|
|
|
/// </summary>
|
2019-10-03 18:55:53 +09:00
|
|
|
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
2019-08-13 14:38:49 +09:00
|
|
|
|
2020-05-27 16:08:47 +09:00
|
|
|
private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
2020-02-17 16:59:35 +09:00
|
|
|
{
|
2020-05-19 16:44:22 +09:00
|
|
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
|
|
|
{
|
|
|
|
Schedule(() =>
|
|
|
|
{
|
2020-05-27 16:08:47 +09:00
|
|
|
beatmapSets.Remove(set);
|
|
|
|
beatmapSets.Add(set);
|
2020-05-19 16:44:22 +09:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-06-26 13:18:03 +09:00
|
|
|
|
2020-05-19 16:44:22 +09:00
|
|
|
private void beatmapRemoved(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
2020-02-17 16:59:35 +09:00
|
|
|
{
|
2020-05-19 16:44:22 +09:00
|
|
|
if (weakSet.NewValue.TryGetTarget(out var set))
|
|
|
|
{
|
|
|
|
Schedule(() =>
|
|
|
|
{
|
|
|
|
beatmapSets.RemoveAll(s => s.ID == set.ID);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
private ScheduledDelegate seekDelegate;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
public void SeekTo(double position)
|
|
|
|
{
|
|
|
|
seekDelegate?.Cancel();
|
|
|
|
seekDelegate = Schedule(() =>
|
2018-11-02 19:04:30 -04:00
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
if (!beatmap.Disabled)
|
|
|
|
current?.Track.Seek(position);
|
|
|
|
});
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
2019-08-19 11:30:04 +09:00
|
|
|
/// <summary>
|
2020-07-10 18:03:56 +09:00
|
|
|
/// Ensures music is playing, no matter what, unless the user has explicitly paused.
|
|
|
|
/// This means that if the current beatmap has a virtual track (see <see cref="TrackVirtual"/>) a new beatmap will be selected.
|
2019-08-19 11:30:04 +09:00
|
|
|
/// </summary>
|
2020-07-10 18:03:56 +09:00
|
|
|
public void EnsurePlayingSomething()
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2020-07-10 18:03:56 +09:00
|
|
|
if (IsUserPaused) return;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2020-07-10 18:03:56 +09:00
|
|
|
var track = current?.Track;
|
2019-10-10 16:52:51 +09:00
|
|
|
|
2020-07-10 16:33:31 +09:00
|
|
|
if (track == null || track is TrackVirtual)
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2019-08-13 14:38:49 +09:00
|
|
|
if (beatmap.Disabled)
|
2020-07-10 18:03:56 +09:00
|
|
|
return;
|
2019-08-13 14:38:49 +09:00
|
|
|
|
2020-07-13 17:28:16 +09:00
|
|
|
NextTrack();
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
2020-07-10 18:03:56 +09:00
|
|
|
else if (!IsPlaying)
|
|
|
|
{
|
|
|
|
Play();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Start playing the current track (if not already playing).
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Whether the operation was successful.</returns>
|
|
|
|
public bool Play(bool restart = false)
|
|
|
|
{
|
|
|
|
var track = current?.Track;
|
|
|
|
|
|
|
|
IsUserPaused = false;
|
|
|
|
|
|
|
|
if (track == null)
|
|
|
|
return false;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-10-10 16:52:51 +09:00
|
|
|
if (restart)
|
|
|
|
track.Restart();
|
|
|
|
else if (!IsPlaying)
|
|
|
|
track.Start();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Stop playing the current track and pause at the current position.
|
|
|
|
/// </summary>
|
|
|
|
public void Stop()
|
|
|
|
{
|
|
|
|
var track = current?.Track;
|
|
|
|
|
2019-10-10 20:12:47 +09:00
|
|
|
IsUserPaused = true;
|
|
|
|
if (track?.IsRunning == true)
|
2018-04-13 18:19:50 +09:00
|
|
|
track.Stop();
|
2019-10-10 16:52:51 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Toggle pause / play.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Whether the operation was successful.</returns>
|
|
|
|
public bool TogglePause()
|
|
|
|
{
|
|
|
|
var track = current?.Track;
|
|
|
|
|
|
|
|
if (track?.IsRunning == true)
|
|
|
|
Stop();
|
2018-04-13 18:19:50 +09:00
|
|
|
else
|
2019-10-10 16:52:51 +09:00
|
|
|
Play();
|
2019-08-13 14:38:49 +09:00
|
|
|
|
|
|
|
return true;
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
/// <summary>
|
2020-04-28 11:46:08 +09:00
|
|
|
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
2019-08-13 14:29:58 +09:00
|
|
|
/// </summary>
|
2020-04-28 11:46:08 +09:00
|
|
|
public void PreviousTrack() => Schedule(() => prev());
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Play the previous track or restart the current track if it's current time below <see cref="restart_cutoff_point"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The <see cref="PreviousTrackResult"/> that indicate the decided action.</returns>
|
|
|
|
private PreviousTrackResult prev()
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2020-07-13 17:28:16 +09:00
|
|
|
if (beatmap.Disabled)
|
|
|
|
return PreviousTrackResult.None;
|
|
|
|
|
2019-10-11 00:12:36 +07:00
|
|
|
var currentTrackPosition = current?.Track.CurrentTime;
|
|
|
|
|
2019-10-11 16:41:54 +07:00
|
|
|
if (currentTrackPosition >= restart_cutoff_point)
|
2019-10-11 00:12:36 +07:00
|
|
|
{
|
|
|
|
SeekTo(0);
|
2019-10-24 13:10:17 +09:00
|
|
|
return PreviousTrackResult.Restart;
|
2019-10-11 00:12:36 +07:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
queuedDirection = TrackChangeDirection.Prev;
|
2018-05-14 17:41:35 +09:00
|
|
|
|
2019-09-17 23:08:37 +09:00
|
|
|
var playable = BeatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? BeatmapSets.LastOrDefault();
|
2019-04-01 12:16:05 +09:00
|
|
|
|
2018-05-14 17:41:35 +09:00
|
|
|
if (playable != null)
|
2018-05-14 17:45:11 +09:00
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
if (beatmap is Bindable<WorkingBeatmap> working)
|
|
|
|
working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
2018-05-23 17:37:39 +09:00
|
|
|
beatmap.Value.Track.Restart();
|
2019-08-13 14:38:49 +09:00
|
|
|
|
2019-10-24 13:10:17 +09:00
|
|
|
return PreviousTrackResult.Previous;
|
2018-05-14 17:45:11 +09:00
|
|
|
}
|
2019-08-13 14:38:49 +09:00
|
|
|
|
2019-10-24 13:10:17 +09:00
|
|
|
return PreviousTrackResult.None;
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
/// <summary>
|
|
|
|
/// Play the next random or playlist track.
|
|
|
|
/// </summary>
|
2020-04-28 11:46:08 +09:00
|
|
|
public void NextTrack() => Schedule(() => next());
|
2019-08-13 14:29:58 +09:00
|
|
|
|
2020-07-10 16:33:31 +09:00
|
|
|
private bool next()
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2020-07-13 17:28:16 +09:00
|
|
|
if (beatmap.Disabled)
|
|
|
|
return false;
|
|
|
|
|
2020-07-10 16:33:31 +09:00
|
|
|
queuedDirection = TrackChangeDirection.Next;
|
2018-05-14 17:41:35 +09:00
|
|
|
|
2020-01-31 18:32:47 +01:00
|
|
|
var playable = BeatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).ElementAtOrDefault(1) ?? BeatmapSets.FirstOrDefault();
|
2019-04-01 12:16:05 +09:00
|
|
|
|
2018-05-14 17:41:35 +09:00
|
|
|
if (playable != null)
|
2018-05-14 17:45:11 +09:00
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
if (beatmap is Bindable<WorkingBeatmap> working)
|
|
|
|
working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
2018-05-23 17:37:39 +09:00
|
|
|
beatmap.Value.Track.Restart();
|
2019-08-13 14:38:49 +09:00
|
|
|
return true;
|
2018-05-14 17:45:11 +09:00
|
|
|
}
|
2019-08-13 14:38:49 +09:00
|
|
|
|
|
|
|
return false;
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
private WorkingBeatmap current;
|
2019-08-13 14:29:58 +09:00
|
|
|
|
|
|
|
private TrackChangeDirection? queuedDirection;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-02-25 19:29:09 +09:00
|
|
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
2018-04-13 18:19:50 +09:00
|
|
|
{
|
2019-08-13 14:29:58 +09:00
|
|
|
TrackChangeDirection direction = TrackChangeDirection.None;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
if (current != null)
|
|
|
|
{
|
2019-02-25 19:29:09 +09:00
|
|
|
bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
if (audioEquals)
|
2019-08-13 14:29:58 +09:00
|
|
|
direction = TrackChangeDirection.None;
|
2018-04-13 18:19:50 +09:00
|
|
|
else if (queuedDirection.HasValue)
|
|
|
|
{
|
|
|
|
direction = queuedDirection.Value;
|
|
|
|
queuedDirection = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-04 18:31:11 -07:00
|
|
|
// figure out the best direction based on order in playlist.
|
2019-09-17 23:08:37 +09:00
|
|
|
var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
|
|
|
var next = beatmap.NewValue == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count();
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
current = beatmap.NewValue;
|
|
|
|
TrackChanged?.Invoke(current, direction);
|
2018-04-13 18:19:50 +09:00
|
|
|
|
2019-09-28 04:18:16 +03:00
|
|
|
ResetTrackAdjustments();
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
|
|
queuedDirection = null;
|
|
|
|
}
|
|
|
|
|
2019-11-15 13:47:14 +09:00
|
|
|
private bool allowRateAdjustments;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Whether mod rate adjustments are allowed to be applied.
|
|
|
|
/// </summary>
|
|
|
|
public bool AllowRateAdjustments
|
|
|
|
{
|
|
|
|
get => allowRateAdjustments;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
if (allowRateAdjustments == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
allowRateAdjustments = value;
|
|
|
|
ResetTrackAdjustments();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-28 04:18:16 +03:00
|
|
|
public void ResetTrackAdjustments()
|
2019-04-08 19:16:34 +09:00
|
|
|
{
|
|
|
|
var track = current?.Track;
|
|
|
|
if (track == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
track.ResetSpeedAdjustments();
|
|
|
|
|
2019-11-15 13:47:14 +09:00
|
|
|
if (allowRateAdjustments)
|
|
|
|
{
|
2019-12-09 17:34:04 +09:00
|
|
|
foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
|
|
|
|
mod.ApplyToTrack(track);
|
2019-11-15 13:47:14 +09:00
|
|
|
}
|
2019-04-08 19:16:34 +09:00
|
|
|
}
|
|
|
|
|
2019-08-13 14:38:49 +09:00
|
|
|
public bool OnPressed(GlobalAction action)
|
|
|
|
{
|
2019-08-14 15:19:21 +09:00
|
|
|
if (beatmap.Disabled)
|
|
|
|
return false;
|
|
|
|
|
2019-08-13 14:38:49 +09:00
|
|
|
switch (action)
|
|
|
|
{
|
|
|
|
case GlobalAction.MusicPlay:
|
|
|
|
if (TogglePause())
|
|
|
|
onScreenDisplay?.Display(new MusicControllerToast(IsPlaying ? "Play track" : "Pause track"));
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case GlobalAction.MusicNext:
|
2020-04-28 11:46:08 +09:00
|
|
|
if (next())
|
2019-08-13 14:38:49 +09:00
|
|
|
onScreenDisplay?.Display(new MusicControllerToast("Next track"));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case GlobalAction.MusicPrev:
|
2020-04-28 11:46:08 +09:00
|
|
|
switch (prev())
|
2019-10-16 20:11:25 +07:00
|
|
|
{
|
2019-10-24 13:10:17 +09:00
|
|
|
case PreviousTrackResult.Restart:
|
2019-10-16 20:11:25 +07:00
|
|
|
onScreenDisplay?.Display(new MusicControllerToast("Restart track"));
|
2019-10-24 08:00:45 +07:00
|
|
|
break;
|
2019-10-16 20:11:25 +07:00
|
|
|
|
2019-10-24 13:10:17 +09:00
|
|
|
case PreviousTrackResult.Previous:
|
2019-10-16 20:11:25 +07:00
|
|
|
onScreenDisplay?.Display(new MusicControllerToast("Previous track"));
|
2019-10-24 08:00:45 +07:00
|
|
|
break;
|
2019-10-16 20:11:25 +07:00
|
|
|
}
|
2019-10-24 08:00:45 +07:00
|
|
|
|
|
|
|
return true;
|
2019-08-13 14:38:49 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-22 13:22:34 +09:00
|
|
|
public void OnReleased(GlobalAction action)
|
|
|
|
{
|
|
|
|
}
|
2019-08-13 14:38:49 +09:00
|
|
|
|
|
|
|
public class MusicControllerToast : Toast
|
|
|
|
{
|
|
|
|
public MusicControllerToast(string action)
|
|
|
|
: base("Music Playback", action, string.Empty)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2019-08-13 14:29:58 +09:00
|
|
|
}
|
2019-06-20 23:40:25 +09:00
|
|
|
|
2019-08-13 14:29:58 +09:00
|
|
|
public enum TrackChangeDirection
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
Next,
|
|
|
|
Prev
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|
2019-10-11 16:41:54 +07:00
|
|
|
|
2019-10-24 13:10:17 +09:00
|
|
|
public enum PreviousTrackResult
|
2019-10-11 16:41:54 +07:00
|
|
|
{
|
|
|
|
None,
|
|
|
|
Restart,
|
|
|
|
Previous
|
|
|
|
}
|
2018-04-13 18:19:50 +09:00
|
|
|
}
|