add new duilite sdks && change voice on fespa and fespl, add 4mic configs && change voice wakeup configs related with platform in cc

This commit is contained in:
wangzijiao 2019-01-11 15:17:58 +08:00
parent 3e2d8c6e03
commit 5fa5110f62
36 changed files with 1136 additions and 59 deletions

View File

@ -0,0 +1,5 @@
package globals
func InitGlobals() {
InitLabWakeupDatastruct()
}

View File

@ -1,5 +1,7 @@
package globals
import "fmt"
const (
MSC_CMD_ONE_SHOT string = "快捷命令"
MSC_CMD_ONE_SHOT_WAKEUP string = "快捷命令WakeupbyMain" //被唤醒后的快捷指令
@ -25,6 +27,7 @@ const (
)
type wakeupVal struct {
Enable bool //used?
WkupWord string //唤醒词
DayThresh string //白天阈值
NightThresh string //夜间阈值
@ -47,6 +50,13 @@ var (
}
)
func InitLabWakeupDatastruct() {
if cfg := GetCurPlatformConfig(); cfg.VoiceConfig.EnableOemWakeupVal {
WkupArray = cfg.VoiceConfig.WakeupVals
fmt.Printf("Rplace the text :%+x\n", cfg.VoiceConfig.WakeupVals)
}
}
//查看是否打开了实验室某个唤醒功能
func IsWakeupCmdEnable(cmd WakeupWordsType) bool {
for _, value := range OneShot.Words {

View File

@ -2,23 +2,37 @@ package globals
import "netease_control_center/interfaces/log"
type PlatformConfig struct {
IconSwitch bool
TopLight bool
MicAdc bool
LedMcuInit bool
InputKeyPath string
FakeVersion bool
type PlatformConfigVoice struct {
EnableOemWakeupVal bool
WakeupVals [MaxWords]wakeupVal
}
type PlatformConfig struct {
IconSwitch bool
TopLight bool
MicAdc bool
LedMcuInit bool
InputKeyPath string
FakeVersion bool
VoiceConfig PlatformConfigVoice
}
var (
platformConfigs = map[string]PlatformConfig{
"default": PlatformConfig{MicAdc:false, LedMcuInit:true,IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event2"},
"EVT":PlatformConfig{MicAdc:true,LedMcuInit:true,IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event2"},
"r311-pv1":PlatformConfig{MicAdc:false, LedMcuInit:true, IconSwitch:true, TopLight:true, InputKeyPath:"/dev/input/event1"},
"r311-pv1c":PlatformConfig{MicAdc:true, LedMcuInit:false, IconSwitch:false, TopLight:false, FakeVersion:true, InputKeyPath:"/dev/input/event1"},
"r311-c1-evb":PlatformConfig{MicAdc:false, LedMcuInit:false, IconSwitch:false, TopLight:false, FakeVersion:true, InputKeyPath:"/dev/input/event1"},
}
curPlatformConfig *PlatformConfig
platformConfigs = map[string]PlatformConfig{
"default": PlatformConfig{MicAdc: false, LedMcuInit: true, IconSwitch: true, TopLight: true, InputKeyPath: "/dev/input/event2"},
"EVT": PlatformConfig{MicAdc: true, LedMcuInit: true, IconSwitch: true, TopLight: true, InputKeyPath: "/dev/input/event2"},
"r311-pv1": PlatformConfig{MicAdc: false, LedMcuInit: true, IconSwitch: true, TopLight: true, InputKeyPath: "/dev/input/event1"},
"r311-pv1c": PlatformConfig{MicAdc: true, LedMcuInit: false, IconSwitch: false, TopLight: false, FakeVersion: true, InputKeyPath: "/dev/input/event1"},
"r311-c1-evb": PlatformConfig{MicAdc: false, LedMcuInit: false, IconSwitch: false, TopLight: false, FakeVersion: true,
VoiceConfig: PlatformConfigVoice{EnableOemWakeupVal: true,
WakeupVals: [MaxWords]wakeupVal{
MainWakeup: wakeupVal{WkupWord: MainWakeupWord, DayThresh: "0.05", NightThresh: "0.06", Major: "0", Dcheck: "0", DayThresh2: "0.05", NightThresh2: "0.05"},
NextSong: wakeupVal{WkupWord: NextSongWord, DayThresh: "0.05", NightThresh: "0.05", Major: "0", Dcheck: "0", DayThresh2: "0.05", NightThresh2: "0.06"},
VolumeAdjust: wakeupVal{WkupWord: string(VolumeUpWord + "," + VolumeDownWord), DayThresh: "0.05,0.05", NightThresh: "0.05,0.05", Major: "0,0", Dcheck: "0,0", DayThresh2: "0.05,0.05", NightThresh2: "0.05,0.05"},
}},
InputKeyPath: "/dev/input/event1"},
}
curPlatformConfig *PlatformConfig
)
func GetCurPlatformConfig() PlatformConfig {
@ -35,10 +49,10 @@ func GetCurPlatformConfig() PlatformConfig {
if queryString == "DVT" {
queryString = "EVT"
}
if tmp,ok := platformConfigs[*ActualHv]; ok {
if tmp, ok := platformConfigs[*ActualHv]; ok {
curPlatformConfig = &tmp
return tmp
} else {
return platformConfigs["default"]
}
}
}

View File

@ -45,6 +45,9 @@ func main() {
log.Println(log.DebugLog, "GitTag: ", *globals.GitTag)
log.Println(log.DebugLog, "Hv: ", *globals.Hv)
//Init globals vars
globals.InitGlobals()
if os.Getenv("ccmode") == "manufacture" {
manufacture.Start()
select {}

View File

@ -604,6 +604,8 @@ func Nduilite_fespa_set_arg(initSdk bool) {
}
}
var tmpEnv struct {
Env string `json:"env"`
}

View File

@ -25,9 +25,24 @@ choice
bool "Used xunfei CAE SDK"
config NETEASE_DUILITE_SDK
bool "Used duilite CAE SDK"
bool "Used duilite sdk!"
endchoice
if NETEASE_DUILITE_SDK
choice
prompt "Selected Duilite SDK Version"
default NETEASE_DUILITE_FESPA_SDK
config NETEASE_DUILITE_FESPA_SDK
bool "Used duilite FESPA(circle mic) SDK for 6mic dida"
config NETEASE_DUILITE_FESPL_SDK
bool "Used duilite FESPL(line mic) for 4 and 2 mic"
endchoice
endif
choice
prompt "Selected TTS SDK"
default XUNFEI_TTS_SDK

View File

@ -15,6 +15,7 @@ $(info CONFIG_XUNFEI_CAE_SDK=$(CONFIG_XUNFEI_CAE_SDK))
$(info CONFIG_NETEASE_MSC_SDK=$(CONFIG_NETEASE_MSC_SDK))
$(info CONFIG_NETEASE_CAE_SDK=$(CONFIG_NETEASE_CAE_SDK))
$(info CONFIG_USED_DC_SDK=$(CONFIG_USED_DC_SDK))
$(info CONFIG_NETEASE_DUILITE_FESPL_SDK=$(CONFIG_NETEASE_DUILITE_FESPL_SDK))
define Package/$(PKG_NAME)
SECTION:=utils
@ -50,10 +51,17 @@ define Package/$(PKG_NAME)
ifeq ('$(CONFIG_USED_DC_SDK)', 'y')
DEPENDS+= +libneteasedc
endif
ifeq ('$(CONFIG_NETEASE_DUILITE_FESPA_SDK)', 'y')
TARGET_CFLAGS+= -DNETEASE_DUILITE_FESPA_SDK=1
endif
ifeq ('$(CONFIG_NETEASE_DUILITE_FESPL_SDK)', 'y')
TARGET_CFLAGS+= -DNETEASE_DUILITE_FESPL_SDK=1
endif
endef
ifeq ('$(CONFIG_NETEASE_DUILITE_SDK)', 'y')
TARGET_LDFLAGS += -lauth_tina -lduilite
TARGET_LDFLAGS += -lauth_tina -lduilite -lauth_tina
endif
ifeq ('$(CONFIG_XUNFEI_MSC_SDK)', 'y')

View File

@ -20,6 +20,8 @@ when who why
/* ------------------------------------------------------------------------
** Includes
** ------------------------------------------------------------------------ */
#if NETEASE_DUILITE_FESPA_SDK
#include "base.h"
#include "cae_lib.h"
#include "error.h"
@ -169,8 +171,8 @@ int Netease_duilite_vad_start() {
duiliteUnlock("vad_start");
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
duiliteok);
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
#else
@ -196,8 +198,8 @@ int Netease_duilite_vad_stop(char IsLock) {
}
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
duiliteok);
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
#else
@ -217,8 +219,8 @@ int Neteaase_duilite_vad_cancel() {
duiliteUnlock(" vad_cancel ");
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n", duilitevad,
duiliteok);
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
@ -291,33 +293,68 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
duilite_callback beamforming_callback,
duilite_callback vad_callback) {
int ret = 0;
char *auth_cfg;
char *cfg;
char *vad_cfg;
char *auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
"\"e3eee41c3276bd027f2814f6cf3b8991\", "
"\"provision\":\"/usr/share/netease/duilite/auth/"
"aiengine-2.9.5-15205715844583be.provision\", "
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
switch (getWorkMode()) {
case WorkMode_R311_C1_EVB:
auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
"\"e3eee41c3276bd027f2814f6cf3b8991\", "
"\"provision\":\"/usr/share/netease/duilite/auth/"
"aiengine-2.9.5-15205715844583be.provision\", "
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
///*初始化时默认采用夜间唤醒阈值thresh=0.59;major=0;thresh2=0.36
///时间同步成功后再根据实际时间来切换阈值*/
char *cfg = "{\"aecBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"AEC_ch8-2-ch6_2ref_NTES_20180413_v0.9.3.bin\", "
"\"wakeupBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"wakeup_aihome_ntes_20180914_pre.bin\", "
"\"beamformingBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"UCA_asr_ch8-2-ch6_70mm_netease_20180425_v1.1.9.bin\", "
"\"env\": \"words=di da di "
"da;thresh=0.59;major=0;dcheck=0;thresh2=0.36;\", "
"\"rollBack\": 0}";
///*初始化时默认采用夜间唤醒阈值thresh=0.59;major=0;thresh2=0.36
///时间同步成功后再根据实际时间来切换阈值*/
cfg = "{\"aecBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"AEC_ch6-2-ch4_1ref_common_20180801_v0.9.4.bin\", "
"\"wakeupBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"wakeup_aifar_comm_20180104.bin\", "
"\"beamformingBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"ULA_asr_ch4_2_ch4_35mm_20181206_v1.1.0.8_asrpost0.bin\", "
"\"env\": \"words=di da di "
"da;thresh=0.59;major=0;dcheck=0;thresh2=0.36;\", "
"\"rollBack\": 0}";
#if USED_NETEASE_DUILITE_VAD
char *vad_cfg = "{\"resBinPath\": "
"\"/usr/share/netease/duilite/vad/"
"vad_aihome_v0.6.bin\",\"pauseTime\": 500}";
vad_cfg = "{\"resBinPath\": "
"\"/usr/share/netease/duilite/vad/"
"vad_aihome_v0.8.bin\",\"pauseTime\": 500}";
#endif
break;
default:
auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
"\"e3eee41c3276bd027f2814f6cf3b8991\", "
"\"provision\":\"/usr/share/netease/duilite/auth/"
"aiengine-2.9.5-15205715844583be.provision\", "
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
///*初始化时默认采用夜间唤醒阈值thresh=0.59;major=0;thresh2=0.36
///时间同步成功后再根据实际时间来切换阈值*/
cfg = "{\"aecBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"AEC_ch8-2-ch6_2ref_NTES_20180413_v0.9.3.bin\", "
"\"wakeupBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"wakeup_aihome_ntes_20180914_pre.bin\", "
"\"beamformingBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"UCA_asr_ch8-2-ch6_70mm_netease_20180425_v1.1.9.bin\", "
"\"env\": \"words=di da di "
"da;thresh=0.59;major=0;dcheck=0;thresh2=0.36;\", "
"\"rollBack\": 0}";
#if USED_NETEASE_DUILITE_VAD
vad_cfg = "{\"resBinPath\": "
"\"/usr/share/netease/duilite/vad/"
"vad_aihome_v0.6.bin\",\"pauseTime\": 500}";
#endif
}
if (1 == duiliteok) {
return 1;
@ -327,7 +364,7 @@ int Netease_nduilite_init(duilite_callback wakeup_callback,
if (NULL == _duilitelock) {
_duilitelock = native_mutex_create(NULL, NULL);
}
ret = duilite_library_load(auth_cfg);
if (0 != ret) {
n_error("Duilite library load fail!(%d)\n", ret);
@ -377,12 +414,12 @@ void Dmic_data_convert(const void *audioData, unsigned int audio_len) {
short tmp;
int bitPerChan = 16;
int chanNum = 8;
//16bit 8 channel, 0,1 is null
if (audio_len%(bitPerChan*chanNum/8) != 0) {
// 16bit 8 channel, 0,1 is null
if (audio_len % (bitPerChan * chanNum / 8) != 0) {
n_error("Input data len(%d) error, not full frame!", audio_len);
}
while(p < (audioData+audio_len)) {
while (p < (audioData + audio_len)) {
p[0] = p[2];
p[1] = p[3];
p[2] = p[4];
@ -415,7 +452,7 @@ void Netease_nduilite_writeaudio(const void *audioData,
return;
}
//n_debug("Write nduilite data, len:%d\n", audio_len);
// n_debug("Write nduilite data, len:%d\n", audio_len);
ret = duilite_fespa_feed(fespa, audioData, audio_len);
#if 0
@ -462,4 +499,5 @@ int Netease_nduilite_reinit(duilite_callback wakeup_callback,
}
return 1;
}
}
#endif

View File

@ -0,0 +1,503 @@
/* =========================================================================
DESCRIPTION
Netease && Xunfei speech processing main program
Cae voice process
Copyright (c) 2017 by Netease, Co,LTD. All Rights Reserved.
============================================================================ */
/* =========================================================================
REVISION
when who why
-------- ---------
-------------------------------------------
2017/06/28 wangzijiao Created.
============================================================================ */
/* ------------------------------------------------------------------------
** Includes
** ------------------------------------------------------------------------ */
#define NETEASE_DUILITE_FESPL_SDK 1
#if NETEASE_DUILITE_FESPL_SDK
#include "base.h"
#include "cae_lib.h"
#include "error.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <jansson.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "msc.h"
#include "nduilite.h"
#include <duilite.h>
/* ------------------------------------------------------------------------
** Macros
** ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
** Defines
** ------------------------------------------------------------------------ */
#define DUILITE_DEBUG (0)
/* ------------------------------------------------------------------------
** Types
** ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------
** Global Variable Definitions
** ------------------------------------------------------------------------ */
static struct duilite_fespl *fespa = NULL;
static NATIVE_MUTEX_HANDLE _duilitelock = NULL;
static volatile char vadstatus = 0; // 0 stop, 1 start
static char duiliteok = 0; // 0 not ok, 1 ok
#if DUILITE_DEBUG
static int fd_audio_orig;
#endif
#if USED_NETEASE_DUILITE_VAD
static struct duilite_vad *duilitevad = NULL;
static duilite_callback oem_vad_cb = NULL;
#endif
static duilite_callback oem_audio_cb = NULL;
/* ------------------------------------------------------------------------
** Function Definitions
** ------------------------------------------------------------------------
*/
int Netease_duilite_fespa_set(char *arg) {
int ret;
if (NULL == arg) {
n_error("Arg is null!");
return -2;
}
if (NULL == fespa) {
n_error("fespa is null, do not set%s\n", arg);
return -1;
}
if (1 != duiliteok) {
n_error("duilite not ok!\n");
return -3;
}
ret = duilite_fespl_set(fespa, arg);
n_debug("Set arg to duilite(ret=%d):%s\n", ret, arg);
}
static void duiliteLock(char *who) {
if (NULL != _duilitelock) {
// n_debug("Lock! %s\n", who);
native_mutex_take(_duilitelock, 0);
}
}
static void duiliteUnlock(char *who) {
if (NULL != _duilitelock) {
// n_debug("UnLock!%s\n", who);
native_mutex_given(_duilitelock);
}
}
static void vad_audiocb(void *userdata, int type, char *msg, int len) {
if (NULL != oem_audio_cb) {
oem_audio_cb(userdata, type, msg, len);
}
#if USED_NETEASE_DUILITE_VAD
if (type == DUILITE_MSG_TYPE_BINARY && duilitevad != NULL) {
duiliteLock("write audio");
if (vadstatus == 1) {
duilite_vad_feed(duilitevad, msg, len);
}
duiliteUnlock("write audio");
}
// n_debug("Get beforming data\n");
#endif
}
#if USED_NETEASE_DUILITE_VAD
static void vad_status_cb(void *userdata, int type, char *msg, int len) {
if (oem_vad_cb != NULL) {
oem_vad_cb(userdata, type, msg, len);
}
if (type == DUILITE_MSG_TYPE_JSON) {
json_t *js = json_loadb(msg, len, 0, NULL);
if (js != NULL) {
json_t *status = json_object_get(js, "status");
if (status != NULL && json_is_integer(status)) {
switch (json_integer_value(status)) {
case 1: // start
setVadStatus(VadStatus_Begin);
break;
case 2: // end
setVadStatus(VadStatus_Finish);
Netease_duilite_vad_stop(0);
break;
default:
n_error("Unknow status:%s\n", msg);
}
}
json_decref(js);
}
}
}
#endif
int Netease_duilite_vad_start() {
#if USED_NETEASE_DUILITE_VAD
int ret = -1;
if (NULL != duilitevad && 1 == duiliteok) {
duiliteLock("vad_start");
if (vadstatus == 1) {
n_debug("Begin to stop, in start!\n");
duilite_vad_stop(duilitevad);
}
ret = duilite_vad_start(duilitevad, NULL);
n_debug("!!!!VAD start!!%d\n", ret);
vadstatus = 1;
duiliteUnlock("vad_start");
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
#else
return 0;
#endif
}
int Netease_duilite_vad_stop(char IsLock) {
#if USED_NETEASE_DUILITE_VAD
int ret = 0;
n_debug("Begin to stop vad!\n");
if (NULL != duilitevad && 1 == duiliteok) {
if (1 == IsLock) {
duiliteLock(" vad_stop ");
}
if (vadstatus == 1) {
ret = duilite_vad_stop(duilitevad);
vadstatus = 0;
}
if (1 == IsLock) {
duiliteUnlock(" vad_stop ");
}
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
#else
return 0;
#endif
}
int Neteaase_duilite_vad_cancel() {
#if USED_NETEASE_DUILITE_VAD
int ret = 0;
if (NULL != duilitevad && 1 == duiliteok) {
duiliteLock(" vad_cancel ");
if (1 == vadstatus) {
ret = duilite_vad_cancel(duilitevad);
vadstatus = 0;
}
duiliteUnlock(" vad_cancel ");
return ret;
} else {
n_error("Duilite check err, duilitevad:0x%p, duiliteok:%d\n",
duilitevad, duiliteok);
return -1;
}
#else
return 0;
#endif
}
// voice binary data convert by HongChuanRong
void CheckData(const void *dataIn, int lenIn, void *dataOut, int *lenOut) {
#define DATA_CHAN_NUM (12)
static short ckDataBuf[DATA_CHAN_NUM];
static int ckDataPos = 0;
static int chanOneFoundFlag = 0;
if (lenIn % sizeof(int) != 0) {
fprintf(stderr, "fatal error!\n");
return;
}
const int totalCountsIn = lenIn / sizeof(int);
const int *pDataIn = (const int *)dataIn;
short *pDataOut = (short *)dataOut;
int countsOut = 0;
if (!chanOneFoundFlag) {
// we have to find chan one first (Peng)
for (auto k = 0; k < totalCountsIn; ++k) {
const int chanId = (pDataIn[k] >> 8) & 0x0f;
if (chanId == 1) {
// chan one found
chanOneFoundFlag = 1;
CheckData(pDataIn + k, (totalCountsIn - k) * sizeof(int),
dataOut, lenOut);
return;
}
}
return;
}
for (auto k = 0; k < totalCountsIn; ++k) {
const int chanId = (pDataIn[k] >> 8) & 0x0f;
if (chanId == (ckDataPos + 1)) {
ckDataBuf[ckDataPos++] = (short)(pDataIn[k] >> 16);
} else {
fprintf(stderr, "expecting chan: %d, input chan: %d\n",
ckDataPos + 1, chanId);
ckDataPos = 0;
}
if (ckDataPos == DATA_CHAN_NUM) {
short finalOut[8];
finalOut[0] = ckDataBuf[8 - 1];
finalOut[1] = ckDataBuf[2 - 1];
finalOut[2] = ckDataBuf[7 - 1];
finalOut[3] = ckDataBuf[1 - 1];
finalOut[4] = ckDataBuf[9 - 1];
finalOut[5] = ckDataBuf[3 - 1];
finalOut[6] = ckDataBuf[4 - 1];
finalOut[7] = ckDataBuf[10 - 1];
memcpy(pDataOut + countsOut, finalOut, sizeof(finalOut));
countsOut += 8;
ckDataPos = 0;
}
}
(*lenOut) = countsOut * sizeof(short);
}
int Netease_nduilite_init(duilite_callback wakeup_callback,
duilite_callback doa_callback,
duilite_callback beamforming_callback,
duilite_callback vad_callback) {
int ret = 0;
char *auth_cfg;
char *cfg;
char *vad_cfg;
switch (getWorkMode()) {
case WorkMode_R311_C1_EVB:
auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
"\"e3eee41c3276bd027f2814f6cf3b8991\",\"deviceId\": \"28ede0d08139\","
"\"provision\":\"/usr/share/netease/duilite/auth/"
"aiengine-2.9.5-15205715844583be.provision\", "
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
///*初始化时默认采用夜间唤醒阈值thresh=0.59;major=0;thresh2=0.36
///时间同步成功后再根据实际时间来切换阈值*/
cfg = "{\"aecBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"AEC_ch6-2-ch4_1ref_common_20180801_v0.9.4.bin\", "
"\"wakeupBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"wakeup_aifar_comm_20180104.bin\", "
"\"beamformingBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"ULA_asr_ch4_2_ch4_35mm_20181206_v1.1.0.8_asrpost0.bin\", "
"\"env\": \"words=di da di da;thresh=0.05;major=0;dcheck=0;thresh2=0.05;\", "
"\"rollBack\": 0}";
#if USED_NETEASE_DUILITE_VAD
vad_cfg = "{\"resBinPath\": "
"\"/usr/share/netease/duilite/vad/"
"vad_aihome_v0.8.bin\",\"pauseTime\": 500}";
#endif
break;
default:
auth_cfg = "{\"appKey\":\"15205715844583be\",\"secretKey\":"
"\"e3eee41c3276bd027f2814f6cf3b8991\", "
"\"provision\":\"/usr/share/netease/duilite/auth/"
"aiengine-2.9.5-15205715844583be.provision\", "
"\"serialNumber\":\"/mnt/UDISK/device.number\"}";
///*初始化时默认采用夜间唤醒阈值thresh=0.59;major=0;thresh2=0.36
///时间同步成功后再根据实际时间来切换阈值*/
cfg = "{\"aecBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"AEC_ch8-2-ch6_2ref_NTES_20180413_v0.9.3.bin\", "
"\"wakeupBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"wakeup_aihome_ntes_20180914_pre.bin\", "
"\"beamformingBinPath\": "
"\"/usr/share/netease/duilite/fespa/"
"UCA_asr_ch8-2-ch6_70mm_netease_20180425_v1.1.9.bin\", "
"\"env\": \"words=di da di "
"da;thresh=0.59;major=0;dcheck=0;thresh2=0.36;\", "
"\"rollBack\": 0}";
#if USED_NETEASE_DUILITE_VAD
vad_cfg = "{\"resBinPath\": "
"\"/usr/share/netease/duilite/vad/"
"vad_aihome_v0.6.bin\",\"pauseTime\": 500}";
#endif
}
if (1 == duiliteok) {
return 1;
}
n_debug("Begin to init duilite!\n");
if (NULL == _duilitelock) {
_duilitelock = native_mutex_create(NULL, NULL);
}
ret = duilite_library_load(auth_cfg);
if (0 != ret) {
n_error("Duilite library load fail!(%d)\n", ret);
return 0;
}
fespa = duilite_fespl_new(cfg);
if (NULL != fespa) {
n_debug("fespa new success!\n");
} else {
n_error("fespa new fail!\n");
duilite_library_release();
return 0;
}
#if USED_NETEASE_DUILITE_VAD
duilitevad = duilite_vad_new(vad_cfg, vad_status_cb, NULL);
oem_vad_cb = vad_callback;
if (NULL == duilitevad) {
n_debug("Vad new fail!\n");
duilite_fespl_delete(fespa);
duilite_library_release();
return 0;
} else {
n_debug("Vad new success!\n");
}
#endif
duilite_fespl_register(fespa, DUILITE_CALLBACK_FESPL_WAKEUP,
wakeup_callback, NULL);
duilite_fespl_register(fespa, DUILITE_CALLBACK_FESPL_DOA, doa_callback,
NULL);
duilite_fespl_register(fespa, DUILITE_CALLBACK_FESPL_BEAMFORMING,
vad_audiocb, NULL);
oem_audio_cb = beamforming_callback;
n_debug("Init duilite finish!\n");
#if DUILITE_DEBUG
fd_audio_orig = open("/tmp/bkconvertdata", O_CREAT | O_APPEND | O_RDWR);
#endif
duiliteok = 1;
return 1;
}
void Dmic_data_convert(const void *audioData, unsigned int audio_len) {
short *p = audioData;
short tmp;
int bitPerChan = 16;
int chanNum = 8;
// 16bit 8 channel, 0,1 is null
if (audio_len % (bitPerChan * chanNum / 8) != 0) {
n_error("Input data len(%d) error, not full frame!", audio_len);
}
while (p < (audioData + audio_len)) {
p[0] = p[2];
p[1] = p[3];
p[2] = p[4];
p[3] = p[5];
p[4] = p[6];
p[5] = p[7];
p[6] = 0x0000;
p[7] = 0x0000;
p += 8;
}
}
void Netease_nduilite_writeaudio(const void *audioData,
unsigned int audio_len) {
int len = 0;
char *newbuf = NULL;
int ret = -1;
if (0 == duiliteok) {
return;
}
if (NULL == fespa) {
n_debug("nduilite fd is null!\n");
return;
}
if (audio_len == 0) {
n_debug("nduilite write audio fail, len = 0\n");
return;
}
//n_debug("Write nduilite data, len:%d\n", audio_len);
ret = duilite_fespl_feed(fespa, audioData, audio_len);
#if 0
newbuf = (char *)malloc(audio_len + 60);
if (newbuf == NULL) {
n_error("nduilite malloc fail!\n");
return;
}
CheckData(audioData, audio_len, (void *)newbuf, &len);
ret = duilite_fespl_feed(fespa, newbuf, len);
#if DUILITE_DEBUG
n_debug("orig data len:%d, convert len:%d, ret:%d\n", audio_len, len, ret);
write(fd_audio_orig, newbuf, len);
#endif
free(newbuf);
#endif
}
int Netease_nduilite_reinit(duilite_callback wakeup_callback,
duilite_callback doa_callback,
duilite_callback beamforming_callback,
duilite_callback vad_callback) {
if (1 == duiliteok) {
duiliteok = 0;
n_debug("Duilite reinit sdk!\n");
usleep(15000);
if (NULL != fespa) {
duilite_fespl_delete(fespa);
fespa = NULL;
}
if (NULL != duilitevad) {
duilite_vad_delete(duilitevad);
duilitevad = NULL;
}
duilite_library_release();
Netease_nduilite_init(wakeup_callback, doa_callback,
beamforming_callback, vad_callback);
}
return 1;
}
#endif

View File

@ -444,7 +444,7 @@ static void *RecordThread(void *param) {
switch (getWorkMode()) {
case WorkMode_R311_C1_EVB:
#define ADC_CH_NUM 6
#define VIRTUAL_CH 2
#define VIRTUAL_CH 0
#define BIT_PER_CH 16
tmpbufsize = record->chunk_size * (ADC_CH_NUM + VIRTUAL_CH) * BIT_PER_CH/8;
tmpbuf = (char *)calloc(1, tmpbufsize);

View File

@ -0,0 +1,219 @@
#ifndef __DUILITE_H__
#define __DUILITE_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef NO_ANDROID
#undef __ANDROID__
#endif
#if (!(defined DUILITE_CALL) || !(defined DUILITE_IMPORT_OR_EXPORT))
#if defined _WIN32
#if defined _WIN64
#define DUILITE_CALL __stdcall
#else
#define DUILITE_CALL
#endif
#ifdef DUILITE_IMPLEMENTION
#define DUILITE_IMPORT_OR_EXPORT __declspec(dllexport)
#else
#define DUILITE_IMPORT_OR_EXPORT __declspec(dllimport)
#endif
#elif defined __ANDROID__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#undef JNIEXPORT
#define JNIEXPORT __attribute ((visibility("default")))
#elif defined __APPLE__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#elif defined __unix__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT __attribute ((visibility("default")))
#else
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#endif
#endif
/* version */
#define DUILITE_MAJOR 0
#define DUILITE_MINOR 7
#define DUILITE_REVISION 0
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define DUILITE_VERSION_STRING TOSTRING(DUILITE_MAJOR) "." TOSTRING(DUILITE_MINOR) "." TOSTRING(DUILITE_REVISION)
#define DUILITE_VERSION_TEXT "AISpeech DUILite SDK V" DUILITE_VERSION_STRING " " __DATE__ " " __TIME__
#define DUILITE_VERSION_NUM (((DUILITE_MAJOR)%100)*10000 + ((DUILITE_MINOR)%100)*100 + ((DUILITE_REVISION)%100))
#define DUILITE_MSG_TYPE_JSON 0
#define DUILITE_MSG_TYPE_BINARY 1
enum duilite_callback_type {
DUILITE_CALLBACK_FESPA_WAKEUP = 0,
DUILITE_CALLBACK_FESPA_DOA,
DUILITE_CALLBACK_FESPA_BEAMFORMING,
DUILITE_CALLBACK_FESPL_WAKEUP,
DUILITE_CALLBACK_FESPL_DOA,
DUILITE_CALLBACK_FESPL_BEAMFORMING,
DUILITE_CALLBACK_FEND_BEAMFORMING
};
typedef int (*duilite_callback)(void *userdata, int type, char *msg, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_library_load(char *cfg);
DUILITE_IMPORT_OR_EXPORT void DUILITE_CALL duilite_library_release();
DUILITE_IMPORT_OR_EXPORT const char *duilite_get_version(void);
struct duilite_vad;
DUILITE_IMPORT_OR_EXPORT struct duilite_vad * DUILITE_CALL duilite_vad_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_start(struct duilite_vad *vad, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_feed(struct duilite_vad *vad, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_stop(struct duilite_vad *vad);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_cancel(struct duilite_vad *vad);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_delete(struct duilite_vad *vad);
struct duilite_speexenc;
DUILITE_IMPORT_OR_EXPORT struct duilite_speexenc * DUILITE_CALL duilite_speexenc_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_start(struct duilite_speexenc *speexenc, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_feed(struct duilite_speexenc *speexenc, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_stop(struct duilite_speexenc *speexenc);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_delete(struct duilite_speexenc *speexenc);
struct duilite_echo;
DUILITE_IMPORT_OR_EXPORT struct duilite_echo * DUILITE_CALL duilite_echo_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_start(struct duilite_echo *echo, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_feed(struct duilite_echo *echo, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_stop(struct duilite_echo *echo);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_cancel(struct duilite_echo *echo);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_delete(struct duilite_echo *echo);
struct duilite_wakeup;
DUILITE_IMPORT_OR_EXPORT struct duilite_wakeup * DUILITE_CALL duilite_wakeup_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_start(struct duilite_wakeup *wakeup, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_feed(struct duilite_wakeup *wakeup, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_stop(struct duilite_wakeup *wakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_cancel(struct duilite_wakeup *wakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_delete(struct duilite_wakeup *wakeup);
struct duilite_cntts;
DUILITE_IMPORT_OR_EXPORT struct duilite_cntts * DUILITE_CALL duilite_cntts_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_start(struct duilite_cntts *cntts, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_feed(struct duilite_cntts *cntts, char *data);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_set(struct duilite_cntts *cntts, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_delete(struct duilite_cntts *cntts);
struct duilite_gram;
DUILITE_IMPORT_OR_EXPORT struct duilite_gram * DUILITE_CALL duilite_gram_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gram_start(struct duilite_gram *gram, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gram_delete(struct duilite_gram *gram);
struct duilite_asr;
DUILITE_IMPORT_OR_EXPORT struct duilite_asr * DUILITE_CALL duilite_asr_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_start(struct duilite_asr *asr, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_feed(struct duilite_asr *asr, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_stop(struct duilite_asr *asr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_cancel(struct duilite_asr *asr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_delete(struct duilite_asr *asr);
struct duilite_fespa;
DUILITE_IMPORT_OR_EXPORT struct duilite_fespa * DUILITE_CALL duilite_fespa_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_register(struct duilite_fespa *fespa, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_start(struct duilite_fespa *fespa, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_feed(struct duilite_fespa *fespa, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_stop(struct duilite_fespa *fespa);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_set(struct duilite_fespa *fespa, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_delete(struct duilite_fespa *fespa);
struct duilite_fespl;
DUILITE_IMPORT_OR_EXPORT struct duilite_fespl * DUILITE_CALL duilite_fespl_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_register(struct duilite_fespl *fespl, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_start(struct duilite_fespl *fespl, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_feed(struct duilite_fespl *fespl, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_stop(struct duilite_fespl *fespl);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_set(struct duilite_fespl *fespl, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_delete(struct duilite_fespl *fespl);
struct duilite_fdm;
DUILITE_IMPORT_OR_EXPORT struct duilite_fdm * DUILITE_CALL duilite_fdm_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_start(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_set(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_get(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_feed(struct duilite_fdm *fdm, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_stop(struct duilite_fdm *fdm);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_delete(struct duilite_fdm *fdm);
struct duilite_nr;
DUILITE_IMPORT_OR_EXPORT struct duilite_nr * DUILITE_CALL duilite_nr_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_start(struct duilite_nr *nr, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_feed(struct duilite_nr *nr, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_stop(struct duilite_nr *nr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_delete(struct duilite_nr *nr);
struct duilite_vprint;
DUILITE_IMPORT_OR_EXPORT struct duilite_vprint * DUILITE_CALL duilite_vprint_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_start(struct duilite_vprint *vprint, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_feed(struct duilite_vprint *vprint, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_stop(struct duilite_vprint *vprint);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_delete(struct duilite_vprint *vprint);
struct duilite_qbye;
DUILITE_IMPORT_OR_EXPORT struct duilite_qbye * DUILITE_CALL duilite_qbye_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_start(struct duilite_qbye *qbye, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_feed(struct duilite_qbye *qbye, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_stop(struct duilite_qbye *qbye);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_delete(struct duilite_qbye *qbye);
struct duilite_gender;
DUILITE_IMPORT_OR_EXPORT struct duilite_gender * DUILITE_CALL duilite_gender_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_start(struct duilite_gender *gender, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_feed(struct duilite_gender *gender, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_stop(struct duilite_gender *gender);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_delete(struct duilite_gender *gender);
struct duilite_semantic;
DUILITE_IMPORT_OR_EXPORT struct duilite_semantic * DUILITE_CALL duilite_semantic_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_start(struct duilite_semantic *semantic, char *param);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_feed(struct duilite_semantic *semantic, char *data, int len);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_stop(struct duilite_semantic *semantic);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_cancel(struct duilite_semantic *semantic);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_delete(struct duilite_semantic *semantic);
struct duilite_nwakeup;
DUILITE_IMPORT_OR_EXPORT struct duilite_nwakeup * DUILITE_CALL duilite_nwakeup_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_start(struct duilite_nwakeup *nwakeup, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_feed(struct duilite_nwakeup *nwakeup, int index, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_stop(struct duilite_nwakeup *nwakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_cancel(struct duilite_nwakeup *nwakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_delete(struct duilite_nwakeup *nwakeup);
struct duilite_dmasp;
DUILITE_IMPORT_OR_EXPORT struct duilite_dmasp * DUILITE_CALL duilite_dmasp_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_start(struct duilite_dmasp *dmasp, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_feed(struct duilite_dmasp *dmasp, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_stop(struct duilite_dmasp *dmasp);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_cancel(struct duilite_dmasp *dmasp);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_delete(struct duilite_dmasp *dmasp);
struct duilite_fend;
DUILITE_IMPORT_OR_EXPORT struct duilite_fend * DUILITE_CALL duilite_fend_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_register(struct duilite_fend *fend, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_start(struct duilite_fend *fend, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_feed(struct duilite_fend *fend, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_stop(struct duilite_fend *fend);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_cancel(struct duilite_fend *fend);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_delete(struct duilite_fend *fend);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,219 @@
#ifndef __DUILITE_H__
#define __DUILITE_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef NO_ANDROID
#undef __ANDROID__
#endif
#if (!(defined DUILITE_CALL) || !(defined DUILITE_IMPORT_OR_EXPORT))
#if defined _WIN32
#if defined _WIN64
#define DUILITE_CALL __stdcall
#else
#define DUILITE_CALL
#endif
#ifdef DUILITE_IMPLEMENTION
#define DUILITE_IMPORT_OR_EXPORT __declspec(dllexport)
#else
#define DUILITE_IMPORT_OR_EXPORT __declspec(dllimport)
#endif
#elif defined __ANDROID__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#undef JNIEXPORT
#define JNIEXPORT __attribute ((visibility("default")))
#elif defined __APPLE__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#elif defined __unix__
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT __attribute ((visibility("default")))
#else
#define DUILITE_CALL
#define DUILITE_IMPORT_OR_EXPORT
#endif
#endif
/* version */
#define DUILITE_MAJOR 0
#define DUILITE_MINOR 7
#define DUILITE_REVISION 0
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define DUILITE_VERSION_STRING TOSTRING(DUILITE_MAJOR) "." TOSTRING(DUILITE_MINOR) "." TOSTRING(DUILITE_REVISION)
#define DUILITE_VERSION_TEXT "AISpeech DUILite SDK V" DUILITE_VERSION_STRING " " __DATE__ " " __TIME__
#define DUILITE_VERSION_NUM (((DUILITE_MAJOR)%100)*10000 + ((DUILITE_MINOR)%100)*100 + ((DUILITE_REVISION)%100))
#define DUILITE_MSG_TYPE_JSON 0
#define DUILITE_MSG_TYPE_BINARY 1
enum duilite_callback_type {
DUILITE_CALLBACK_FESPA_WAKEUP = 0,
DUILITE_CALLBACK_FESPA_DOA,
DUILITE_CALLBACK_FESPA_BEAMFORMING,
DUILITE_CALLBACK_FESPL_WAKEUP,
DUILITE_CALLBACK_FESPL_DOA,
DUILITE_CALLBACK_FESPL_BEAMFORMING,
DUILITE_CALLBACK_FEND_BEAMFORMING
};
typedef int (*duilite_callback)(void *userdata, int type, char *msg, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_library_load(char *cfg);
DUILITE_IMPORT_OR_EXPORT void DUILITE_CALL duilite_library_release();
DUILITE_IMPORT_OR_EXPORT const char *duilite_get_version(void);
struct duilite_vad;
DUILITE_IMPORT_OR_EXPORT struct duilite_vad * DUILITE_CALL duilite_vad_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_start(struct duilite_vad *vad, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_feed(struct duilite_vad *vad, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_stop(struct duilite_vad *vad);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_cancel(struct duilite_vad *vad);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vad_delete(struct duilite_vad *vad);
struct duilite_speexenc;
DUILITE_IMPORT_OR_EXPORT struct duilite_speexenc * DUILITE_CALL duilite_speexenc_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_start(struct duilite_speexenc *speexenc, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_feed(struct duilite_speexenc *speexenc, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_stop(struct duilite_speexenc *speexenc);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_speexenc_delete(struct duilite_speexenc *speexenc);
struct duilite_echo;
DUILITE_IMPORT_OR_EXPORT struct duilite_echo * DUILITE_CALL duilite_echo_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_start(struct duilite_echo *echo, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_feed(struct duilite_echo *echo, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_stop(struct duilite_echo *echo);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_cancel(struct duilite_echo *echo);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_echo_delete(struct duilite_echo *echo);
struct duilite_wakeup;
DUILITE_IMPORT_OR_EXPORT struct duilite_wakeup * DUILITE_CALL duilite_wakeup_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_start(struct duilite_wakeup *wakeup, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_feed(struct duilite_wakeup *wakeup, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_stop(struct duilite_wakeup *wakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_cancel(struct duilite_wakeup *wakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_wakeup_delete(struct duilite_wakeup *wakeup);
struct duilite_cntts;
DUILITE_IMPORT_OR_EXPORT struct duilite_cntts * DUILITE_CALL duilite_cntts_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_start(struct duilite_cntts *cntts, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_feed(struct duilite_cntts *cntts, char *data);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_set(struct duilite_cntts *cntts, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_cntts_delete(struct duilite_cntts *cntts);
struct duilite_gram;
DUILITE_IMPORT_OR_EXPORT struct duilite_gram * DUILITE_CALL duilite_gram_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gram_start(struct duilite_gram *gram, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gram_delete(struct duilite_gram *gram);
struct duilite_asr;
DUILITE_IMPORT_OR_EXPORT struct duilite_asr * DUILITE_CALL duilite_asr_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_start(struct duilite_asr *asr, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_feed(struct duilite_asr *asr, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_stop(struct duilite_asr *asr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_cancel(struct duilite_asr *asr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_asr_delete(struct duilite_asr *asr);
struct duilite_fespa;
DUILITE_IMPORT_OR_EXPORT struct duilite_fespa * DUILITE_CALL duilite_fespa_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_register(struct duilite_fespa *fespa, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_start(struct duilite_fespa *fespa, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_feed(struct duilite_fespa *fespa, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_stop(struct duilite_fespa *fespa);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_set(struct duilite_fespa *fespa, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespa_delete(struct duilite_fespa *fespa);
struct duilite_fespl;
DUILITE_IMPORT_OR_EXPORT struct duilite_fespl * DUILITE_CALL duilite_fespl_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_register(struct duilite_fespl *fespl, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_start(struct duilite_fespl *fespl, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_feed(struct duilite_fespl *fespl, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_stop(struct duilite_fespl *fespl);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_set(struct duilite_fespl *fespl, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fespl_delete(struct duilite_fespl *fespl);
struct duilite_fdm;
DUILITE_IMPORT_OR_EXPORT struct duilite_fdm * DUILITE_CALL duilite_fdm_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_start(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_set(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_get(struct duilite_fdm *fdm, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_feed(struct duilite_fdm *fdm, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_stop(struct duilite_fdm *fdm);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fdm_delete(struct duilite_fdm *fdm);
struct duilite_nr;
DUILITE_IMPORT_OR_EXPORT struct duilite_nr * DUILITE_CALL duilite_nr_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_start(struct duilite_nr *nr, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_feed(struct duilite_nr *nr, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_stop(struct duilite_nr *nr);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nr_delete(struct duilite_nr *nr);
struct duilite_vprint;
DUILITE_IMPORT_OR_EXPORT struct duilite_vprint * DUILITE_CALL duilite_vprint_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_start(struct duilite_vprint *vprint, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_feed(struct duilite_vprint *vprint, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_stop(struct duilite_vprint *vprint);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_vprint_delete(struct duilite_vprint *vprint);
struct duilite_qbye;
DUILITE_IMPORT_OR_EXPORT struct duilite_qbye * DUILITE_CALL duilite_qbye_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_start(struct duilite_qbye *qbye, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_feed(struct duilite_qbye *qbye, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_stop(struct duilite_qbye *qbye);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_qbye_delete(struct duilite_qbye *qbye);
struct duilite_gender;
DUILITE_IMPORT_OR_EXPORT struct duilite_gender * DUILITE_CALL duilite_gender_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_start(struct duilite_gender *gender, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_feed(struct duilite_gender *gender, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_stop(struct duilite_gender *gender);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_gender_delete(struct duilite_gender *gender);
struct duilite_semantic;
DUILITE_IMPORT_OR_EXPORT struct duilite_semantic * DUILITE_CALL duilite_semantic_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_start(struct duilite_semantic *semantic, char *param);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_feed(struct duilite_semantic *semantic, char *data, int len);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_stop(struct duilite_semantic *semantic);
//DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_cancel(struct duilite_semantic *semantic);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_semantic_delete(struct duilite_semantic *semantic);
struct duilite_nwakeup;
DUILITE_IMPORT_OR_EXPORT struct duilite_nwakeup * DUILITE_CALL duilite_nwakeup_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_start(struct duilite_nwakeup *nwakeup, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_feed(struct duilite_nwakeup *nwakeup, int index, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_stop(struct duilite_nwakeup *nwakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_cancel(struct duilite_nwakeup *nwakeup);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_nwakeup_delete(struct duilite_nwakeup *nwakeup);
struct duilite_dmasp;
DUILITE_IMPORT_OR_EXPORT struct duilite_dmasp * DUILITE_CALL duilite_dmasp_new(char *cfg, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_start(struct duilite_dmasp *dmasp, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_feed(struct duilite_dmasp *dmasp, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_stop(struct duilite_dmasp *dmasp);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_cancel(struct duilite_dmasp *dmasp);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_dmasp_delete(struct duilite_dmasp *dmasp);
struct duilite_fend;
DUILITE_IMPORT_OR_EXPORT struct duilite_fend * DUILITE_CALL duilite_fend_new(char *cfg);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_register(struct duilite_fend *fend, int callback_type, duilite_callback callback, void *userdata);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_start(struct duilite_fend *fend, char *param);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_feed(struct duilite_fend *fend, char *data, int len);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_stop(struct duilite_fend *fend);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_cancel(struct duilite_fend *fend);
DUILITE_IMPORT_OR_EXPORT int DUILITE_CALL duilite_fend_delete(struct duilite_fend *fend);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
毻氏茲咸挝葯茪湚任葹仙浫茩炍螢湚毴蓹褪认勢憺嫋墯稇墣敋紣崥珕彋屳扭轀懷垶敋姀萦轀懷槏瀿萦轀懷瀸嵮崥溳虞湋褕灁殜弽殰萦轀懷洆槏殞咻虞湋褜殤嬔寙戄虞湋褜泴茛虞墯崒枑戄泡灃殤槚憵彝哑咽萦輿殙枩毉殬枌媿嗇泡棆嫃牛校袨妺椦瀼栄灃審殮湕褱悞洑墫湚萦輿殙枩毝洬啅気泡挒溳虞殗彇崥菖萃鲜弦瓮姨陷虞瀼彺殕菖菸释鲜任是怂是虧気<EFBFBD>

20
lib/libduilite/Config.in Normal file
View File

@ -0,0 +1,20 @@
if PACKAGE_libduilite
comment "DUILITE SDK Select"
choice
prompt "Selected Duilite version"
default DUILITE_6MIC
config DUILITE_6MIC
bool "6 mic version"
config DUILITE_4MIC
bool "4 mic version"
config DUILITE_2MIC
bool "2 mic version"
endchoice
endif

View File

@ -8,12 +8,32 @@ PKG_BUILD_DIR:=$(COMPILE_DIR)/$(PKG_NAME)
include $(BUILD_DIR)/package.mk
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
$(info 6mic=$(CONFIG_DUILITE_6MIC))
$(info 4mic=$(CONFIG_DUILITE_4MIC))
$(info 2mic=$(CONFIG_DUILITE_2MIC))
define Package/$(PKG_NAME)
CATEGORY:=Netease
SUBMENU:=libs
SECTION:=libs
TITLE:=Duilife voice library
DEPENDS:=+libstdcpp
ifeq ('$(CONFIG_DUILITE_6MIC)', 'y')
DUILITE_DOCUMENT:=6mic
endif
ifeq ('$(CONFIG_DUILITE_4MIC)', 'y')
DUILITE_DOCUMENT:=4mic
endif
ifeq ('$(CONFIG_DUILITE_2MIC)', 'y')
DUILITE_DOCUMENT:=2mic
endif
endef
define Package/$(PKG_NAME)/description
@ -22,7 +42,7 @@ endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) -d ./lib/* $(PKG_BUILD_DIR)/
$(CP) -d ./$(DUILITE_DOCUMENT)/lib/* $(PKG_BUILD_DIR)/
endef
define Build/Configure
@ -34,16 +54,16 @@ endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include/msc
$(INSTALL_DATA) ./lib/*.so $(1)/usr/lib/
$(INSTALL_DATA) ./lib/include/*.h $(1)/usr/include/
$(INSTALL_DATA) ./$(DUILITE_DOCUMENT)/lib/*.so $(1)/usr/lib/
$(INSTALL_DATA) ./$(DUILITE_DOCUMENT)/lib/*.h $(1)/usr/include/
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DATA) ./lib/*.so $(1)/usr/lib/
$(INSTALL_DATA) ./${DUILITE_DOCUMENT}/lib/*.so $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/share/netease/duilite
$(CP) -d ./res/* $(1)/usr/share/netease/duilite/
$(CP) -d ./${DUILITE_DOCUMENT}/res/* $(1)/usr/share/netease/duilite/
# $(INSTALL_DATA) ./res/common.jet $(1)/usr/share/netease/
endef