forked from opencog/TinyCog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFestivalTTS.cpp
60 lines (53 loc) · 1.06 KB
/
FestivalTTS.cpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
Project: OpenCogER
File: FestivalTTS.cpp
Author: Mandeep Singh Bhatia
License: AGPL
Date: 2017
*/
#include "act/audio/FestivalTTS.hpp"
FestivalTTS::FestivalTTS():TTS()
{
//init
ok=true;
msg="";
int heap_size = 210000; // default scheme heap size
int load_init_files = 1; // we want the festival init files loaded
festival_initialize(load_init_files,heap_size);
}
FestivalTTS::~FestivalTTS()
{
festival_wait_for_spooler();
}
bool FestivalTTS::isOk()
{
return ok;
}
string FestivalTTS::getMessage()
{
return msg;
}
bool FestivalTTS::speak(string spk)
{
if (festival_say_text(spk.c_str()))return true;
return false;
}
void FestivalTTS::setSpeaker(speaker spkr)
{
string st;
switch(spkr)
{
case speaker::RAB:
st="(voice_rab_diphone)";
break;
case speaker::DON:
st="(voice_don_diphone)";
break;
case speaker::KAL:
st="(voice_kal_diphone)";
break;
default:
st="(voice_rab_diphone)";
}
festival_eval_command(st.c_str());
}