Queue is broken, `onQueue` never gets decremented?
onQueue
seems to be added to the queue insertion index, and incremented when adding to the queue, so multiple tracks that are queued get played in the order they're added.
However, it doesn't seem to ever be reset or decremented. So after you've played through your queue, or if you jump around, if you keep adding new songs to the queue, they appear many slots after the current playing index.
I suppose the "Play Queue", as a concept, represents its own data structure.
It's conceptually a separate list. So if you emulate it by messing with indices in the main playlist, I suspect it will always be kludgy.
Possible solutions:
- Replace "Queue" with "Play Next".
-
- Don't bother trying to add to the "end" of the virtual queue.
-
- Albums that are added at once can still be kept in order.
- Keep track of the play queue as a separate list.
-
- This sounds like it could get quite messy in many parts of the data, logic, and UI. (So now you have to track whether the currently playing track is on the queue or the main playlist, and what index you should go to when you transition between them, and somehow show that in the GUI.)
- Keep track of the play queue as a virtual list, by marking which items in the main playlist are "Queue" items.
-
- Make each playlist item remember whether it's a regular item or a "Queue" item.
-
- When adding to the queue, scan from the current index to the first index that isn't a "Queue" item.
-
- Probably display queued tracks collapsed and greyed out.
Originally I was going to PR either the first or third solution above. But, another possibility:
Just get rid of the "Queue" button completely.-
Since I found out you can hold and drag from the tracks view onto the playlist view, I think this is probably the best option.
-
"Queue" doesn't actually add any new capabilities. It's redundant, and also broken.
-
Make hold-and-drag more discoverable somehow?
Actually, I suppose hold-and-drag may not work on touch interfaces (or keyboard), so the the context menu "Queue" would still be important for that.