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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//! Rust bindings for the ai-coustics SDK.
//!
//! The SDK requires a license key. Generate one at
//! [developers.ai-coustics.com](https://developers.ai-coustics.com).
//!
//! # Installation
//!
//! ```bash
//! cargo add aic-sdk --features download-lib
//! ```
//!
//! `download-lib` fetches the matching native library during the build. See [`docs::linking`] for
//! the alternatives and for how the library is found at run time.
//!
//! # Quick start
//!
//! ```rust,no_run
//! use aic_sdk::{include_model, ProcessorConfig, Model, Processor};
//!
//! // Embed model at compile time (or use Model::from_file to load at runtime)
//! static MODEL: &[u8] = include_model!("path/to/model.aicmodel");
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Get your license key from the environment variable
//! let license_key = std::env::var("AIC_SDK_LICENSE")?;
//!
//! // Load the embedded model (or download manually at https://artifacts.ai-coustics.io/)
//! let model = Model::from_buffer(MODEL)?;
//!
//! // Get optimal configuration based on the selected model
//! let config = ProcessorConfig::optimal(&model);
//!
//! // Create a processor and initialize it
//! let mut processor = Processor::new(&model, &license_key)?.with_config(&config)?;
//!
//! // Process mono audio
//! let mut audio_block = vec![0.0f32; config.block_size];
//! processor.process(&mut audio_block)?;
//!
//! Ok(())
//! }
//! ```
//!
//! # Where to go next
//!
//! [`docs::guide`] walks through the API, [`docs::examples`] has complete programs, and
//! [`docs::linking`] covers how the native library is linked and found.
//!
//! Models and their IDs are listed at
//! [artifacts.ai-coustics.io](https://artifacts.ai-coustics.io); the product documentation lives at
//! [docs.ai-coustics.com](https://docs.ai-coustics.com).
//!
//! # License
//!
//! This Rust wrapper is distributed under the Apache 2.0 license.
//! The core C SDK is distributed under the proprietary AIC-SDK license.
//!
//! `NOTICE.txt` in this crate lists the third-party software distributed with the SDK.
use ;
use CStr;
use Path;
// `test_support` is shared verbatim with the integration tests, which reach the SDK as `aic_sdk`;
// the alias lets the same file resolve inside this crate too.
extern crate self as aic_sdk;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use DynamicLoadingError;
/// Loads the AIC dynamic library from `path` when the `runtime-linking` feature is enabled.
///
/// This is optional. With `runtime-linking`, the library is loaded automatically on first use
/// from the platform default name (`libaic.so` / `libaic.dylib` / `aic.dll`) via the OS loader
/// search path. Call this only to pick a specific file, and do so before the first SDK call.
///
/// # Safety
///
/// `path` must point to an AIC dynamic library that is ABI-compatible with this crate's bundled
/// `aic.h` header. Loading an incompatible library can cause undefined behavior when SDK functions
/// are called.
pub unsafe
/// Returns whether an AIC dynamic library has already been loaded.
/// Returns the version of the SDK.
///
/// # Note
/// This is not necessarily the same as this crate's version.
///
/// # Returns
///
/// Returns the SDK version string, or `"unknown"` if it cannot be decoded.
///
/// # Example
///
/// ```rust
/// let version = aic_sdk::get_sdk_version();
/// println!("ai-coustics SDK version: {version}");
/// ```
/// Returns the model version compatible with the SDK.
/// This function is only used to identify SDKs by ai-coustics and should not be called by users of this crate.
///
/// # Safety
///
/// Callers must use the wrapper ID assigned to them by ai-coustics.
pub unsafe