From 2ff8eac022f397bb1aed28aca376fbe422fc8b3c Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 29 May 2024 14:45:49 +1000 Subject: Start on TTS support by logging the data that will become TTS lines Includes some misc cleanup of haptic double-triggering (or non-triggering), since those cases all end up being TTS event double-reporting, which to me crosses the threshold from "annoying" to "usability issue" --- src/tangara/system_fsm/booting.cpp | 2 ++ src/tangara/system_fsm/service_locator.hpp | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/tangara/system_fsm') diff --git a/src/tangara/system_fsm/booting.cpp b/src/tangara/system_fsm/booting.cpp index 22a0fcac..feba0dc0 100644 --- a/src/tangara/system_fsm/booting.cpp +++ b/src/tangara/system_fsm/booting.cpp @@ -38,6 +38,7 @@ #include "system_fsm/service_locator.hpp" #include "system_fsm/system_events.hpp" #include "tasks.hpp" +#include "tts/provider.hpp" #include "ui/ui_fsm.hpp" namespace system_fsm { @@ -99,6 +100,7 @@ auto Booting::entry() -> void { std::make_unique(sServices->bg_worker())); sServices->tag_parser(std::make_unique()); sServices->collator(locale::CreateCollator()); + sServices->tts(std::make_unique()); ESP_LOGI(kTag, "init bluetooth"); sServices->bluetooth(std::make_unique( diff --git a/src/tangara/system_fsm/service_locator.hpp b/src/tangara/system_fsm/service_locator.hpp index 5b2205eb..3d136f3a 100644 --- a/src/tangara/system_fsm/service_locator.hpp +++ b/src/tangara/system_fsm/service_locator.hpp @@ -10,17 +10,18 @@ #include "audio/track_queue.hpp" #include "battery/battery.hpp" -#include "drivers/bluetooth.hpp" #include "collation.hpp" #include "database/database.hpp" #include "database/tag_parser.hpp" +#include "drivers/bluetooth.hpp" #include "drivers/gpios.hpp" #include "drivers/haptics.hpp" #include "drivers/nvs.hpp" #include "drivers/samd.hpp" #include "drivers/storage.hpp" -#include "tasks.hpp" #include "drivers/touchwheel.hpp" +#include "tasks.hpp" +#include "tts/provider.hpp" namespace system_fsm { @@ -69,6 +70,13 @@ class ServiceLocator { auto battery(std::unique_ptr i) { battery_ = std::move(i); } + auto tts() -> tts::Provider& { + assert(tts_ != nullptr); + return *tts_; + } + + auto tts(std::unique_ptr i) { tts_ = std::move(i); } + auto touchwheel() -> std::optional { if (!touchwheel_) { return {}; @@ -140,6 +148,7 @@ class ServiceLocator { std::unique_ptr queue_; std::unique_ptr battery_; + std::unique_ptr tts_; std::shared_ptr database_; std::unique_ptr tag_parser_; -- cgit v1.2.3