Add non-streaming ASR support for HarmonyOS. (#1564)

This commit is contained in:
Fangjun Kuang
2024-11-26 16:38:35 +08:00
committed by GitHub
parent a4b79f077c
commit 298b6b6fda
50 changed files with 648 additions and 454 deletions

View File

@@ -4,6 +4,15 @@
#include "sherpa-onnx/csrc/vad-model.h"
#if __ANDROID_API__ >= 9
#include "android/asset_manager.h"
#include "android/asset_manager_jni.h"
#endif
#if __OHOS__
#include "rawfile/raw_file_manager.h"
#endif
#include "sherpa-onnx/csrc/silero-vad-model.h"
namespace sherpa_onnx {
@@ -13,20 +22,20 @@ std::unique_ptr<VadModel> VadModel::Create(const VadModelConfig &config) {
return std::make_unique<SileroVadModel>(config);
}
#if __ANDROID_API__ >= 9
std::unique_ptr<VadModel> VadModel::Create(AAssetManager *mgr,
template <typename Manager>
std::unique_ptr<VadModel> VadModel::Create(Manager *mgr,
const VadModelConfig &config) {
// TODO(fangjun): Support other VAD models.
return std::make_unique<SileroVadModel>(mgr, config);
}
#if __ANDROID_API__ >= 9
template std::unique_ptr<VadModel> VadModel::Create(
AAssetManager *mgr, const VadModelConfig &config);
#endif
#if __OHOS__
std::unique_ptr<VadModel> VadModel::Create(NativeResourceManager *mgr,
const VadModelConfig &config) {
// TODO(fangjun): Support other VAD models.
return std::make_unique<SileroVadModel>(mgr, config);
}
template std::unique_ptr<VadModel> VadModel::Create(
NativeResourceManager *mgr, const VadModelConfig &config);
#endif
} // namespace sherpa_onnx