feat: commands for next/previous album that respect shuffle settings #3007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature
This pull request implements commands that can be bound to hotkeys:
Playback/Play Next Album
,Playback/Play Previous Album
,Playback/Play Random Album
. The latter goes to first track of a random album in the current playlist. The behaviour of the first two depends on the shuffle setting and is as follows.DDB_SHUFFLE_RANDOM
,DDB_SHUFFLE_TRACKS
: same as Play Next Track and Play Previous Track.DDB_SHUFFLE_OFF
,DDB_SHUFFLE_ALBUMS
:Implementation
While Play (Next/Previous) Album mimic repeated calls to Play (Next/Previous) Track, they are implemented with separate functions to avoid having to search the playlist repeatedly. This would be
O(#tracks on album * #tracks in playlist)
inDDB_SHUFFLE_ALBUMS
; now they areO(#tracks in playlist)
.Thus the pull request consists of 4 commits, viz., in order:
To discuss
I've tried to follow DeaDBeeF's style as best as I understand it. :^) But of course I'll be happy to lint before merging if I haven't been fully consistent.
Because the pull request introduces new signals
DB_EV_PLAY_(NEXT|PREV|RANDOM)_ALBUM
I think we need to bump the API version before merging. I've left it until then because I thought it best to receive signoff first.