summaryrefslogtreecommitdiff
path: root/src/tangara/tts/provider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tangara/tts/provider.cpp')
-rw-r--r--src/tangara/tts/provider.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tangara/tts/provider.cpp b/src/tangara/tts/provider.cpp
index 2b1dd4e6..d19500e0 100644
--- a/src/tangara/tts/provider.cpp
+++ b/src/tangara/tts/provider.cpp
@@ -49,9 +49,18 @@ auto Provider::feed(const Event& e) -> void {
// ESP_LOGI(kTag, "new selection: '%s', interactive? %i",
// ev.new_selection->description.value_or("").c_str(),
// ev.new_selection->is_interactive);
- std::string new_desc = ev.new_selection->description.value_or("");
+ auto text = ev.new_selection->description;
+ if (!text) {
+ ESP_LOGW(kTag, "missing description for element");
+ return;
+ }
+ auto file = textToFile(*text);
+ if (!file) {
+ return;
+ }
+
if (player_) {
- player_->playFile(textToFile(new_desc).value_or(""));
+ player_->playFile(*text, *file);
}
}
}