From 39f7545cd5ef7a30bbd482f3579df7744c6b688d Mon Sep 17 00:00:00 2001 From: jacqueline Date: Fri, 7 Jul 2023 15:29:47 +1000 Subject: wire up the playing screen with some real data Includes implementing song duration calculation for CBR MP3 files --- src/app_console/app_console.cpp | 7 +++++-- src/app_console/include/app_console.hpp | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/app_console') diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp index b0a90155..2b5b84f7 100644 --- a/src/app_console/app_console.cpp +++ b/src/app_console/app_console.cpp @@ -30,6 +30,7 @@ namespace console { std::weak_ptr AppConsole::sDatabase; +audio::TrackQueue* AppConsole::sTrackQueue; int CmdListDir(int argc, char** argv) { auto lock = AppConsole::sDatabase.lock(); @@ -108,9 +109,10 @@ int CmdPlayFile(int argc, char** argv) { if (is_id) { database::TrackId id = std::atoi(argv[1]); - events::Dispatch( - audio::PlayTrack{.id = id}); + AppConsole::sTrackQueue->AddLast(id); } else { + // TODO. + /* std::ostringstream path; path << '/' << argv[1]; for (int i = 2; i < argc; i++) { @@ -119,6 +121,7 @@ int CmdPlayFile(int argc, char** argv) { events::Dispatch( audio::PlayFile{.filename = path.str()}); + */ } return 0; diff --git a/src/app_console/include/app_console.hpp b/src/app_console/include/app_console.hpp index 48ce0d38..3cb62b21 100644 --- a/src/app_console/include/app_console.hpp +++ b/src/app_console/include/app_console.hpp @@ -10,12 +10,14 @@ #include "console.hpp" #include "database.hpp" +#include "track_queue.hpp" namespace console { class AppConsole : public Console { public: static std::weak_ptr sDatabase; + static audio::TrackQueue* sTrackQueue; protected: virtual auto RegisterExtraComponents() -> void; -- cgit v1.2.3