2 #include "speaker_include.h"
9 COpenJtalkCore::COpenJtalkCore():
13 COpenJtalkCore::~COpenJtalkCore(){
14 if(this->manageFlag == true)this->Clear();
17 void COpenJtalkCore::Initialize( HTS_Boolean use_lpf, int sampling_rate,
18 int fperiod, double alpha, int stage, double beta, int audio_buff_size,
19 double uv_threshold, HTS_Boolean use_log_gain, double gv_weight_mgc,
20 double gv_weight_lf0, double gv_weight_lpf){
21 if(this->manageFlag == true)this->Clear();
22 ::OpenJTalk_initialize(&this->openJtalk_internal,use_lpf,sampling_rate,fperiod,alpha,stage,
23 beta,audio_buff_size,uv_threshold,use_log_gain,gv_weight_mgc,gv_weight_lf0,gv_weight_lpf);
25 this->manageFlag = true;
28 void COpenJtalkCore::Load( const TChar_P in_voiceDataDir,const TChar_P in_dictinalyDataDir, Char_P fn_ms_dur, Char_P fn_ts_dur,
29 Char_P fn_ms_mgc, Char_P fn_ts_mgc, Char_P *fn_ws_mgc, int num_ws_mgc,
30 Char_P fn_ms_lf0, Char_P fn_ts_lf0, Char_P *fn_ws_lf0, int num_ws_lf0,
31 Char_P fn_ms_lpf, Char_P fn_ts_lpf, Char_P *fn_ws_lpf, int num_ws_lpf,
32 Char_P fn_ms_gvm, Char_P fn_ts_gvm, Char_P fn_ms_gvl, Char_P fn_ts_gvl,
33 Char_P fn_ms_gvf, Char_P fn_ts_gvf,Char_P fn_gv_switch){
35 if(this->manageFlag == true){
37 CStringA dictionaryDataDir(in_dictinalyDataDir); //
\8e«
\8f\91\83f
\81[
\83^
\83f
\83B
\83\8c\83N
\83g
\83\8a
38 CStringA voiceDataDir(in_voiceDataDir); //
\89¹
\90º
\81[
\83f
\81[
\83^
\83f
\83B
\83\8c\83N
\83g
\83\8a
40 std::vector<Char_P> ws_mgcList(num_ws_mgc);
43 for(int ws_mgc_index = 0;ws_mgc_index < num_ws_mgc;++ws_mgc_index){
45 ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_mgc_index]));
48 std::vector<Char_P> ws_lf0List(num_ws_lf0);
50 for(int ws_lf0Index = 0;ws_lf0Index < num_ws_lf0;++ws_lf0Index){
52 ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_lf0Index]));
55 std::vector<Char_P> ws_lpfList(num_ws_lpf);
57 for(int ws_lpfIndex = 0;ws_lpfIndex < num_ws_lpf;++ws_lpfIndex){
59 ws_mgcList.push_back((char *)(const char*)(voiceDataDir + fn_ws_mgc[ws_lpfIndex]));
62 ::OpenJTalk_load(&this->openJtalk_internal,
63 (char *)(const char*)(dictionaryDataDir),
64 (char *)(const char*)(voiceDataDir +fn_ms_dur),
65 (char *)(const char*)(voiceDataDir +fn_ts_dur),
66 (char *)(const char*)(voiceDataDir +fn_ms_mgc),
67 (char *)(const char*)(voiceDataDir +fn_ts_mgc),
70 (char *)(const char*)(voiceDataDir +fn_ms_lf0),
71 (char *)(const char*)(voiceDataDir +fn_ts_lf0),
74 (char *)(const char*)(voiceDataDir +fn_ms_lpf),
75 (char *)(const char*)(voiceDataDir +fn_ts_lpf),
78 (char *)(const char*)(voiceDataDir +fn_ms_gvm),
79 (char *)(const char*)(voiceDataDir +fn_ts_gvm),
80 (char *)(const char*)(voiceDataDir +fn_ms_gvl),
81 (char *)(const char*)(voiceDataDir +fn_ts_gvl),
82 (char *)(const char*)(voiceDataDir +fn_ms_gvf),
83 (char *)(const char*)(voiceDataDir +fn_ts_gvf),
89 void COpenJtalkCore::Synthesis( Char_P txt, FILE * wavfp, FILE * logfp){
90 ::OpenJTalk_synthesis(&this->openJtalk_internal,txt,wavfp,logfp);
94 void COpenJtalkCore::Clear(){
95 ::OpenJTalk_clear(&this->openJtalk_internal);
96 this->manageFlag = false;