mirror of
https://github.com/aaru-dps/RedBookPlayer.git
synced 2025-12-16 19:24:41 +00:00
Implement shuffle (not surfaced)
This commit is contained in:
@@ -100,6 +100,12 @@ namespace RedBookPlayer.GUI.ViewModels
|
||||
PlayerView?.ViewModel?.ExecutePreviousTrack();
|
||||
}
|
||||
|
||||
// Shuffle Track List
|
||||
// else if(e.Key == App.Settings.ShuffleTracksKey)
|
||||
// {
|
||||
// PlayerView?.ViewModel?.ExecuteShuffle();
|
||||
// }
|
||||
|
||||
// Next Index
|
||||
else if(e.Key == App.Settings.NextIndexKey)
|
||||
{
|
||||
|
||||
@@ -470,6 +470,11 @@ namespace RedBookPlayer.GUI.ViewModels
|
||||
/// </summary>
|
||||
public void ExecutePreviousTrack() => _player?.PreviousTrack();
|
||||
|
||||
/// <summary>
|
||||
/// Shuffle the current track list
|
||||
/// </summary>
|
||||
public void ExecuteShuffle() => _player?.ShuffleTracks();
|
||||
|
||||
/// <summary>
|
||||
/// Move to the next index
|
||||
/// </summary>
|
||||
|
||||
@@ -180,6 +180,11 @@ namespace RedBookPlayer.GUI.ViewModels
|
||||
/// </summary>
|
||||
public Key PreviousTrackKey { get; set; } = Key.Left;
|
||||
|
||||
/// <summary>
|
||||
/// Key assigned to shuffling the track list
|
||||
/// </summary>
|
||||
// public Key ShuffleTracksKey { get; set; } = Key.R;
|
||||
|
||||
/// <summary>
|
||||
/// Key assigned to move to the next index
|
||||
/// </summary>
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace RedBookPlayer.Models.Hardware
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the track list into the track dictionary for the current disc
|
||||
/// Load the track list into the track dictionary
|
||||
/// </summary>
|
||||
private void LoadTrackList()
|
||||
{
|
||||
@@ -455,6 +455,14 @@ namespace RedBookPlayer.Models.Hardware
|
||||
}
|
||||
|
||||
// Try to get back to the last loaded track
|
||||
SetTrackOrderIndex();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the current track order index, if possible
|
||||
/// </summary>
|
||||
private void SetTrackOrderIndex()
|
||||
{
|
||||
int currentFoundTrack = 0;
|
||||
if(_trackPlaybackOrder == null || _trackPlaybackOrder.Count == 0)
|
||||
{
|
||||
@@ -553,6 +561,16 @@ namespace RedBookPlayer.Models.Hardware
|
||||
}
|
||||
|
||||
_trackPlaybackOrder = newPlaybackOrder;
|
||||
switch(PlayerState)
|
||||
{
|
||||
case PlayerState.Stopped:
|
||||
_currentTrackInOrder = 0;
|
||||
break;
|
||||
case PlayerState.Paused:
|
||||
case PlayerState.Playing:
|
||||
SetTrackOrderIndex();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -924,7 +942,7 @@ namespace RedBookPlayer.Models.Hardware
|
||||
_opticalDiscs[CurrentDisc].LoadTrack(trackNumber);
|
||||
}
|
||||
|
||||
LoadTrackList();
|
||||
SetTrackOrderIndex();
|
||||
if(wasPlaying == PlayerState.Playing)
|
||||
Play();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user