summaryrefslogtreecommitdiff
path: root/src/tangara/tts/provider.hpp
blob: e46950cebe5a56f88dcdfae93550c66db1ef30ff (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
38
39
40
41
42
43
44
45
/*
 * Copyright 2024 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#pragma once

#include <memory>
#include <optional>
#include <string>
#include <variant>

#include "drivers/nvs.hpp"
#include "tts/events.hpp"
#include "tts/player.hpp"

namespace tts {

/*
 * A TTS Provider is responsible for receiving system events that may be
 * relevant to TTS, and digesting them into discrete 'utterances' that can be
 * used to generate audio feedback.
 */
class Provider {
 public:
  Provider(drivers::NvsStorage& nvs);

  auto player(std::unique_ptr<Player>) -> void;

  auto feed(const Event&) -> void;

  // Not copyable or movable.
  Provider(const Provider&) = delete;
  Provider& operator=(const Provider&) = delete;

  static bool SamplesOnSDCard();

 private:
  drivers::NvsStorage& nvs_;
  std::unique_ptr<Player> player_;
  bool tts_enabled_;
};

}  // namespace tts