From 7197da21f6bcc1aaa5d1905228e0e2ec1caf3fa8 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Mon, 17 Jul 2023 16:54:35 +1000 Subject: Basic playlists for upcoming Beware under-testing and bugs. Just getting something barebones in so that I can do rN+1 bringup --- src/audio/include/track_queue.hpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'src/audio/include/track_queue.hpp') diff --git a/src/audio/include/track_queue.hpp b/src/audio/include/track_queue.hpp index 840d71ee..49c0d61b 100644 --- a/src/audio/include/track_queue.hpp +++ b/src/audio/include/track_queue.hpp @@ -6,10 +6,12 @@ #pragma once -#include +#include +#include #include #include +#include "source.hpp" #include "track.hpp" namespace audio { @@ -44,7 +46,9 @@ class TrackQueue { * If there is no current track, the given track will begin playback. */ auto AddNext(database::TrackId) -> void; - auto AddNext(const std::vector&) -> void; + auto AddNext(std::shared_ptr) -> void; + + auto IncludeNext(std::shared_ptr) -> void; /* * Enqueues a track, placing it the end of all enqueued tracks. @@ -52,7 +56,9 @@ class TrackQueue { * If there is no current track, the given track will begin playback. */ auto AddLast(database::TrackId) -> void; - auto AddLast(const std::vector&) -> void; + auto AddLast(std::shared_ptr) -> void; + + auto IncludeLast(std::shared_ptr) -> void; /* * Advances to the next track in the queue, placing the current track at the @@ -65,11 +71,6 @@ class TrackQueue { * Removes all tracks from all queues, and stops any currently playing track. */ auto Clear() -> void; - /* - * Removes a specific track from the queue of upcoming tracks. Has no effect - * on the currently playing track. - */ - auto RemoveUpcoming(database::TrackId) -> void; TrackQueue(const TrackQueue&) = delete; TrackQueue& operator=(const TrackQueue&) = delete; @@ -77,9 +78,13 @@ class TrackQueue { private: mutable std::mutex mutex_; - std::deque played_; - std::deque upcoming_; - std::optional current_; + std::list>> + played_; + std::list, + std::shared_ptr>> + enqueued_; }; } // namespace audio -- cgit v1.2.3