-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspeaking.h
47 lines (31 loc) · 927 Bytes
/
speaking.h
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
46
47
//
// Created by prostoichelovek on 01.05.19.
//
#ifndef SPEECH_SPEAKING_H
#define SPEECH_SPEAKING_H
#include "RHVoice/core/smart_ptr.hpp"
#include "RHVoice/core/engine.hpp"
#include "RHVoice/core/document.hpp"
#include "RHVoice/audio.hpp"
// https://github.com/Olga-Yakovleva/RHVoice/blob/master/src/test/test.cpp
class audio_player : public RHVoice::client {
public:
explicit audio_player(const std::string &path);
audio_player() = default;
bool play_speech(const short *samples, size_t count);
void finish();
bool set_sample_rate(int sample_rate);
private:
RHVoice::audio::playback_stream stream;
};
class RHSpeaker {
public:
RHVoice::smart_ptr<RHVoice::engine> eng;
explicit RHSpeaker(std::string voice);
void setVoice(std::string voice);
void say(std::string text);
private:
audio_player player;
RHVoice::voice_profile profile;
};
#endif //SPEECH_SPEAKING_H