From b6330279ce49959e91ab092c8e0f31a4744ab85a Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 21 Feb 2022 21:53:41 -0800 Subject: [PATCH] Start playback on first shuffle item in shuffle When in shuffle mode, start playback on the first item in the shuffle list, rather than the selection, or the start of the playlist. Fixes #241 Signed-off-by: Christopher Snowhill --- Application/PlaybackController.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index 7f5f8d33b..5b2e97745 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -139,11 +139,16 @@ NSString *CogPlaybackDidStopNotficiation = @"CogPlaybackDidStopNotficiation"; } - (IBAction)play:(id)sender { - if([playlistView selectedRow] == -1) - [playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO]; + if([playlistController shuffle] != ShuffleOff) { + PlaylistEntry *pe = [playlistController shuffledEntryAtIndex:0]; + [self playEntryAtIndex:pe.index]; + } else { + if([playlistView selectedRow] == -1) + [playlistView selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO]; - if([playlistView selectedRow] > -1) - [self playEntryAtIndex:(int)[playlistView selectedRow]]; + if([playlistView selectedRow] > -1) + [self playEntryAtIndex:(int)[playlistView selectedRow]]; + } } NSDictionary *makeRGInfo(PlaylistEntry *pe) {