summaryrefslogtreecommitdiff
path: root/src/tangara/input/feedback_tts.hpp
blob: 00fbf06d8b5ce0fbd46f1cab1e719ed5d8a01bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright 2024 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <cstdint>

#include "core/lv_obj.h"
#include "drivers/haptics.hpp"

#include "input/feedback_device.hpp"
#include "tts/events.hpp"
#include "tts/provider.hpp"

namespace input {

class TextToSpeech : public IFeedbackDevice {
 public:
  TextToSpeech(tts::Provider&);

  auto feedback(lv_group_t*, uint8_t event_type) -> void override;
  auto feedback(lv_group_t*, InputEvent event) -> void override;

 private:
  tts::Provider& tts_;

  auto describe(lv_obj_t&) -> void;
  auto findDescription(lv_obj_t&) -> std::optional<std::string>;

  lv_group_t* last_group_;
  lv_obj_t* last_obj_;
};

}  // namespace input