From 3f7f199cb940c8d5f6d48f77fd59971adffe49ef Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 7 Dec 2023 16:57:05 +1100 Subject: Remove pre-iterator concepts - No more IndexRecord/Result/dbGetPage nonsense - Queue is just track ids - i am so tired and have so much to do --- src/audio/fatfs_audio_input.cpp | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'src/audio/fatfs_audio_input.cpp') diff --git a/src/audio/fatfs_audio_input.cpp b/src/audio/fatfs_audio_input.cpp index 5594718f..58d5852f 100644 --- a/src/audio/fatfs_audio_input.cpp +++ b/src/audio/fatfs_audio_input.cpp @@ -50,23 +50,19 @@ FatfsAudioInput::FatfsAudioInput(database::ITagParser& tag_parser, bg_worker_(bg_worker), new_stream_mutex_(), new_stream_(), - has_new_stream_(false), - pending_path_() {} + has_new_stream_(false) {} FatfsAudioInput::~FatfsAudioInput() {} -auto FatfsAudioInput::SetPath(std::future> fut) - -> void { - std::lock_guard guard{new_stream_mutex_}; - pending_path_.reset( - new database::FutureFetcher>( - std::move(fut))); - - has_new_stream_ = true; - has_new_stream_.notify_one(); +auto FatfsAudioInput::SetPath(std::optional path) -> void { + if (path) { + SetPath(*path); + } else { + SetPath(); + } } -auto FatfsAudioInput::SetPath(const std::pmr::string& path) -> void { +auto FatfsAudioInput::SetPath(const std::string& path) -> void { std::lock_guard guard{new_stream_mutex_}; if (OpenFile(path)) { has_new_stream_ = true; @@ -96,16 +92,6 @@ auto FatfsAudioInput::NextStream() -> std::shared_ptr { continue; } - // If the path is a future, then wait for it to complete. - if (pending_path_) { - auto res = pending_path_->Result(); - pending_path_.reset(); - - if (res && *res) { - OpenFile(**res); - } - } - if (new_stream_ == nullptr) { continue; } @@ -117,7 +103,7 @@ auto FatfsAudioInput::NextStream() -> std::shared_ptr { } } -auto FatfsAudioInput::OpenFile(const std::pmr::string& path) -> bool { +auto FatfsAudioInput::OpenFile(const std::string& path) -> bool { ESP_LOGI(kTag, "opening file %s", path.c_str()); auto tags = tag_parser_.ReadAndParseTags(path); -- cgit v1.2.3