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.
 
 
 
 

90 lines
1.9 KiB

//
#pragma once
#define SDK_DLL_API __declspec(dllimport)
#include "libs/pthread/include/pthread.h"
#include "include/macros.h"
#include "include/parameter.h"
#include "include/param_decl.h"
#include "include/service.h"
#include "include/speech_sds.h"
#include "include/wav_utils.h"
//方便外面引用统一的头文件
#include "online_tts_demo.h"
#ifndef LX_DLL_CLASS_EXPORTS
#define CPP_DLL_API __declspec(dllexport)
#else
#define CPP_DLL_API __declspec(dllimport)
#endif
//#define CPP_DLL_API __declspec(dllexport)
//extern "C" CPP_DLL_API int Add(int a, int b);
typedef void(*WriteMessageType)(int number);
typedef void(*ResultCallbackType)(int code, const char * type, const char * info );
namespace mobvoi {
namespace sds {
class CPP_DLL_API OnlineRecognizerDemo {
public:
OnlineRecognizerDemo();
~OnlineRecognizerDemo();
void setRecognitionParams(bool enablePartial);
bool startRecognition();
bool startRecognition(void* Function);
void callCSharp(int code, const char * type, const char * info);
//
int Add(int a, int b);
void WriteMessage(int number , void* Function);
class RecognizerCallBack;
private:
bool Run(int argc, char* argv[]);
const std::string& GetType() const;
void SetType(const std::string& type);
bool ParseCmdArgs(int argc, char* argv[]);
bool InitEnv();
bool GetService();
bool InvokeService();
bool ReleaseService();
bool ReleaseEnv();
bool InvokeSetParamService();
bool InvokeStartService();
bool InvokeFeedSpeech();
bool InvokeStopService();
bool InvokeCancelService();
void ShowUsage(const std::string& exe);
void Notify();
private:
std::string base_dir_;
Service* service_;
std::vector<char> waves_;
std::string service_type_;
bool stop_;
bool enablePartial_;
pthread_mutex_t mutex_;
pthread_cond_t cond_;
SpeechSDS* sds_;
RecognizerCallBack * pCallback;
ResultCallbackType cSharpCallback;
};
}
}