From 9a2ac6ae5aa2f4cfdfbaf6ded40e66e70989e353 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 21 Feb 2022 22:01:01 -0800 Subject: [PATCH] When starting playback, start shuffle at selection If starting playback from a given playlist entry, or selection, then start shuffle mode from that track. Otherwise, start shuffle from the beginning of the shuffle list. Signed-off-by: Christopher Snowhill --- Application/PlaybackController.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index 5b2e97745..ceb693e09 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -140,7 +140,12 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation"; - (IBAction)play:(id)sender { if([playlistController shuffle] != ShuffleOff) { - PlaylistEntry *pe = [playlistController shuffledEntryAtIndex:0]; + PlaylistEntry *pe = nil; + + NSInteger index = [playlistView selectedRow]; + if(index != -1) pe = [playlistController entryAtIndex:index]; + + pe = [playlistController shuffledEntryAtIndex:(pe ? pe.shuffleIndex : 0)]; [self playEntryAtIndex:pe.index]; } else { if([playlistView selectedRow] == -1)