You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.5 KiB
69 lines
1.5 KiB
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <WinSock2.h>
|
|
//#include <WS2tcpip.h>
|
|
//#pragma comment( lib, "ws2_32" )
|
|
//#pragma comment(lib,"winmm")
|
|
|
|
|
|
//#include "include/loadSdkDll.h"
|
|
|
|
#include "sds/interface/macros.h"
|
|
#include "sds/interface/speech_sds.h"
|
|
|
|
//???????
|
|
#ifndef LX_DLL_CLASS_EXPORTS
|
|
#define CPP_DLL_API __declspec(dllexport)
|
|
#else
|
|
#define CPP_DLL_API __declspec(dllimport)
|
|
#endif
|
|
|
|
namespace mobvoi {
|
|
namespace sds {
|
|
|
|
class CPP_DLL_API OnlineTtsHelper {
|
|
public:
|
|
static OnlineTtsHelper* GetInstance();
|
|
|
|
void SetTtsParas( std::string language, std::string speaker, std::string speed);
|
|
bool StartTts(std::string ttsContent);
|
|
bool StopTts();
|
|
|
|
private:
|
|
bool Run(int argc, char* argv[]);
|
|
bool ParseCmdArgs(int argc, char* argv[]);
|
|
bool InitEnv();
|
|
bool GetService();
|
|
bool ReleaseService();
|
|
bool ReleaseEnv();
|
|
|
|
bool InvokeSetParams();
|
|
bool InvokeStart();
|
|
bool InvokeFeedText(std::string text);
|
|
bool InvokeReadTtsData();
|
|
bool InvokeStop();
|
|
|
|
void PlayTts(std::string fullName);
|
|
private:
|
|
SpeechSDS* speech_sds_;
|
|
std::string base_dir_;
|
|
Service* service_;
|
|
std::string ttsContent_;
|
|
std::string language_;
|
|
std::string speaker_;
|
|
std::string speed_;
|
|
bool finishTts_;
|
|
OnlineTtsHelper() : speech_sds_(nullptr), service_(nullptr) {}
|
|
~OnlineTtsHelper() {}
|
|
DISALLOW_COPY_AND_ASSIGN(OnlineTtsHelper);
|
|
};
|
|
|
|
} // namespace sds
|
|
} // namespace mobvoi
|
|
|