Skip to main content

sherpa_onnx_sys/
lib.rs

1//! Raw FFI bindings for [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx).
2//!
3//! # Environment variables
4//!
5//! The build script (`build.rs`) recognises the following environment
6//! variables, all of which are optional:
7//!
8//! | Variable | Purpose |
9//! |---|---|
10//! | `SHERPA_ONNX_LIB_DIR` | Path to a directory that already contains the |
11//! | | pre-built native libraries (`.so` / `.dylib` / `.dll` / `.a`). |
12//! | | When set, the build script skips downloading and uses these |
13//! | | libraries directly. |
14//! | `SHERPA_ONNX_ARCHIVE_DIR` | Path to a directory that contains |
15//! | | pre-downloaded archive files (`.tar.bz2` or `.xcframework.zip`). |
16//! | | When set, the build script copies the archive from this directory |
17//! | | instead of downloading it from the internet. The archive must have |
18//! | | the same filename that would normally be downloaded (e.g. |
19//! | | `sherpa-onnx-v1.13.8-linux-x64-shared-lib.tar.bz2`). |
20
21#![allow(non_camel_case_types)]
22#![allow(non_snake_case)]
23#![allow(non_upper_case_globals)]
24
25use std::os::raw::c_char;
26
27extern "C" {
28    pub fn SherpaOnnxGetVersionStr() -> *const c_char;
29    pub fn SherpaOnnxGetGitSha1() -> *const c_char;
30    pub fn SherpaOnnxGetGitDate() -> *const c_char;
31    pub fn SherpaOnnxGetOnnxruntimeVersionStr() -> *const c_char;
32    pub fn SherpaOnnxFileExists(filename: *const c_char) -> i32;
33}
34
35pub mod audio_tagging;
36pub mod kws;
37pub mod offline_asr;
38pub mod offline_punctuation;
39pub mod offline_speaker_diarization;
40pub mod online_asr;
41pub mod online_punctuation;
42pub mod resampler;
43pub mod speaker_embedding;
44pub mod speech_denoiser;
45pub mod spoken_language_identification;
46pub mod tts;
47pub mod vad;
48pub mod wave;
49
50pub use audio_tagging::*;
51pub use kws::*;
52pub use offline_asr::*;
53pub use offline_punctuation::*;
54pub use offline_speaker_diarization::*;
55pub use online_asr::*;
56pub use online_punctuation::*;
57pub use resampler::*;
58pub use speaker_embedding::*;
59pub use speech_denoiser::*;
60pub use spoken_language_identification::*;
61pub use tts::*;
62pub use vad::*;
63pub use wave::*;