13 changed files with 231 additions and 82 deletions
-
1.gitignore
-
4.vscode/settings.json
-
8CMakeLists.txt
-
4README.md
-
61cmakepc.cmake
-
2dep/zlinuxcomponents
-
10sh/envsetup.sh
-
5sh/envsetup_pc.sh
-
11sh/envsetuppc.sh
-
24sh/iflytool.sh
-
4sh/packet.sh
-
53src/service/voiceprocess/asr_service.hpp
@ -0,0 +1,61 @@ |
|||
# 设置通用编译选项 |
|||
set(C_CPP_FLAGS "${C_CPP_FLAGS} ") |
|||
set(C_CPP_FLAGS |
|||
"${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable" |
|||
) |
|||
set(C_CPP_FLAGS |
|||
"${C_CPP_FLAGS} -Wno-unused-local-typedefs -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wno-unused-variable" |
|||
) |
|||
set(C_CPP_FLAGS |
|||
"${C_CPP_FLAGS} -Werror=return-type -Werror=parentheses -Wfatal-errors -Wno-comment" |
|||
) |
|||
set(C_CPP_FLAGS "${C_CPP_FLAGS} -Wno-format-overflow") |
|||
set(C_CPP_FLAGS "${C_CPP_FLAGS} -O0 -g3 -fPIC -Wall") |
|||
|
|||
# 设置C编译选项 |
|||
set(CMAKE_C_FLAGS "${C_CPP_FLAGS}") |
|||
message("CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}") |
|||
|
|||
# 设置CPP编译选项 |
|||
set(CMAKE_CXX_FLAGS "${C_CPP_FLAGS}") |
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move -Wno-reorder") |
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") |
|||
message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") |
|||
message("PROJECT_NAME: ${PROJECT_NAME}") |
|||
message("PUBLIC_LINK_DIRECTORIES: ${PUBLIC_LINK_DIRECTORIES}") |
|||
message("PUBLIC_INCLUDE_DIRECTORIES: ${PUBLIC_INCLUDE_DIRECTORIES}") |
|||
|
|||
# 添加相应的依赖代码 |
|||
include(dep/iflytopcpp/module.cmake) |
|||
include(dep/asio1.12.2/module.cmake) |
|||
include(dep/websocketpp/module.cmake) |
|||
include(dep/zservice_container/module.cmake) |
|||
include(dep/zwebservice/module.cmake) |
|||
include(dep/zlinuxcomponents/alsaplayer/module.cmake) |
|||
include(dep/zlinuxcomponents/rootfs_auto_update/module.cmake) |
|||
include(dep/zlinuxcomponents/mycroft_precise/module.cmake) |
|||
include(dep/zlinuxcomponents/audio/module.cmake) |
|||
include(dep/zlinuxcomponents/aiui_ws/module.cmake) |
|||
|
|||
# 设置当前工程依赖的头文件路径和链接的库文件 |
|||
set(DEP_LINK_LIBRARIES |
|||
${DEP_LINK_LIBRARIES} |
|||
# ffmpeg |
|||
avcodec |
|||
avdevice |
|||
avfilter |
|||
avformat |
|||
avutil |
|||
swresample |
|||
swscale |
|||
m |
|||
# sys |
|||
asound |
|||
pthread |
|||
# |
|||
# curlpp curl |
|||
) |
|||
zadd_executable_simple(TARGET alsaplayer_main.out SRC |
|||
dep/zlinuxcomponents/alsaplayer/alsaplayer_main.cpp) |
|||
zadd_executable_simple(TARGET audio_recorder_main.out SRC |
|||
dep/zlinuxcomponents/audio/audio_recorder_main.cpp) |
@ -1 +1 @@ |
|||
Subproject commit f7277b52ca5ec37ca4de55ac44c8f2d8a5be61ae |
|||
Subproject commit cc20701d9b4e719524821a98fb7b0a8334fbe3f9 |
@ -1,5 +0,0 @@ |
|||
# 构造build.sh |
|||
echo "cmake ../ \\" >${PROJECT_PATH}/build/build.sh |
|||
echo "-DCMAKE_C_COMPILER=gcc \\" >>${PROJECT_PATH}/build/build.sh |
|||
echo "-DCMAKE_CXX_COMPILER=g++ \\" >>${PROJECT_PATH}/build/build.sh |
|||
chmod +x ${PROJECT_PATH}/build/build.sh |
@ -0,0 +1,11 @@ |
|||
cd ${PROJECT_PATH}/buildpc |
|||
|
|||
wget -c "192.168.1.2:8021/sdk_firefly_rk3328_v2.5.1/buildtools/cmake-3.13.0-Linux-x86_64.tar.gz" |
|||
rm -rf cmake-3.13.0-Linux-x86_64 |
|||
tar -xvf cmake-3.13.0-Linux-x86_64.tar.gz |
|||
mv cmake-3.13.0-Linux-x86_64 cmake |
|||
CMAKE_BIN=${PROJECT_PATH}/buildpc/cmake/bin/cmake |
|||
|
|||
# 构造buildpc/build.sh |
|||
echo "${CMAKE_BIN} ../ -DBUILD_FOR_TEST_ON_PC=true " >${PROJECT_PATH}/buildpc/build.sh |
|||
chmod +x ${PROJECT_PATH}/buildpc/build.sh |
@ -0,0 +1,53 @@ |
|||
//
|
|||
// Created by zwsd
|
|||
//
|
|||
|
|||
#pragma once
|
|||
#include <fstream>
|
|||
#include <iostream>
|
|||
#include <list>
|
|||
#include <map>
|
|||
#include <memory>
|
|||
#include <set>
|
|||
#include <sstream>
|
|||
#include <string>
|
|||
#include <vector>
|
|||
|
|||
#include "iflytopcpp/core/basic/nlohmann/json.hpp"
|
|||
#include "iflytopcpp/core/basic/nod/nod.hpp"
|
|||
#include "iflytopcpp/core/spdlogfactory/logger.hpp"
|
|||
#include "iflytopcpp/core/thread/thread.hpp"
|
|||
|
|||
/**
|
|||
* @brief |
|||
* |
|||
* service: AsrService |
|||
* |
|||
* 监听事件: |
|||
* 依赖状态: |
|||
* 依赖服务: |
|||
* 作用: |
|||
* |
|||
*/ |
|||
|
|||
namespace iflytop { |
|||
using namespace std; |
|||
using namespace core; |
|||
using namespace nlohmann; |
|||
class AsrService : public enable_shared_from_this<AsrService> { |
|||
ENABLE_LOGGER(AsrService); |
|||
|
|||
public: |
|||
nod::signal<void(json& asrResult)> onAsrResult; |
|||
nod::signal<void()> onVoiceEnd; |
|||
|
|||
private: |
|||
//
|
|||
public: |
|||
AsrService(){}; |
|||
|
|||
void initialize(string appid, string key); |
|||
void writeVoice(uint16_t* voice, size_t voiceLen); |
|||
void writeVoiceEnd(); |
|||
}; |
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue