sherpa_onnx.dart
1000 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2024 Xiaomi Corporation
import 'dart:io';
import 'dart:ffi';
export 'src/feature_config.dart';
export 'src/offline_recognizer.dart';
export 'src/offline_stream.dart';
export 'src/online_recognizer.dart';
export 'src/online_stream.dart';
export 'src/speaker_identification.dart';
export 'src/vad.dart';
export 'src/wave_reader.dart';
export 'src/wave_writer.dart';
import 'src/sherpa_onnx_bindings.dart';
final DynamicLibrary _dylib = () {
if (Platform.isIOS) {
throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
}
if (Platform.isMacOS) {
return DynamicLibrary.open('libsherpa-onnx-c-api.dylib');
}
if (Platform.isAndroid || Platform.isLinux) {
return DynamicLibrary.open('libsherpa-onnx-c-api.so');
}
if (Platform.isWindows) {
return DynamicLibrary.open('sherpa-onnx-c-api.dll');
}
throw UnsupportedError('Unknown platform: ${Platform.operatingSystem}');
}();
void initBindings() {
SherpaOnnxBindings.init(_dylib);
}