1#[doc = r" If Bindgen could only determine the size and alignment of a"]
7#[doc = r" type, it is represented like this."]
8#[derive(PartialEq, Copy, Clone, Debug, Hash)]
9#[repr(C)]
10pub struct __BindgenOpaqueArray<T: Copy, const N: usize>(pub [T; N]);
11impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray<T, N> {
12 fn default() -> Self {
13 Self([<T as Default>::default(); N])
14 }
15}
16pub const BELA_MAJOR_VERSION: u32 = 1;
17pub const BELA_MINOR_VERSION: u32 = 18;
18pub const BELA_BUGFIX_VERSION: u32 = 0;
19pub const BELA_AUDIO_PRIORITY: u32 = 95;
20pub const DEFAULT_LINE_OUT_LEVEL: f64 = 0.0;
21pub const DEFAULT_PGA_GAIN: u32 = 16;
22pub const DEFAULT_HP_LEVEL: f64 = -6.0;
23pub const BELA_FLAG_INTERLEAVED: u32 = 1;
24pub const BELA_FLAG_ANALOG_OUTPUTS_PERSIST: u32 = 2;
25pub const BELA_FLAG_DETECT_UNDERRUNS: u32 = 4;
26pub const BELA_FLAG_OFFLINE: u32 = 8;
27pub type __off_t = ::core::ffi::c_long;
28pub type __off64_t = ::core::ffi::c_long;
29pub type __time_t = ::core::ffi::c_long;
30pub type __clockid_t = ::core::ffi::c_int;
31pub type __syscall_slong_t = ::core::ffi::c_long;
32pub type __gnuc_va_list = __BindgenOpaqueArray<u64, 4usize>;
33pub type FILE = _IO_FILE;
34#[repr(C)]
35#[derive(Debug, Copy, Clone)]
36pub struct _IO_marker {
37 _unused: [u8; 0],
38}
39#[repr(C)]
40#[derive(Debug, Copy, Clone)]
41pub struct _IO_codecvt {
42 _unused: [u8; 0],
43}
44#[repr(C)]
45#[derive(Debug, Copy, Clone)]
46pub struct _IO_wide_data {
47 _unused: [u8; 0],
48}
49pub type _IO_lock_t = ::core::ffi::c_void;
50#[repr(C)]
51#[derive(Debug, Copy, Clone)]
52pub struct _IO_FILE {
53 pub _flags: ::core::ffi::c_int,
54 pub _IO_read_ptr: *mut ::core::ffi::c_char,
55 pub _IO_read_end: *mut ::core::ffi::c_char,
56 pub _IO_read_base: *mut ::core::ffi::c_char,
57 pub _IO_write_base: *mut ::core::ffi::c_char,
58 pub _IO_write_ptr: *mut ::core::ffi::c_char,
59 pub _IO_write_end: *mut ::core::ffi::c_char,
60 pub _IO_buf_base: *mut ::core::ffi::c_char,
61 pub _IO_buf_end: *mut ::core::ffi::c_char,
62 pub _IO_save_base: *mut ::core::ffi::c_char,
63 pub _IO_backup_base: *mut ::core::ffi::c_char,
64 pub _IO_save_end: *mut ::core::ffi::c_char,
65 pub _markers: *mut _IO_marker,
66 pub _chain: *mut _IO_FILE,
67 pub _fileno: ::core::ffi::c_int,
68 pub _flags2: ::core::ffi::c_int,
69 pub _old_offset: __off_t,
70 pub _cur_column: ::core::ffi::c_ushort,
71 pub _vtable_offset: ::core::ffi::c_schar,
72 pub _shortbuf: [::core::ffi::c_char; 1usize],
73 pub _lock: *mut _IO_lock_t,
74 pub _offset: __off64_t,
75 pub _codecvt: *mut _IO_codecvt,
76 pub _wide_data: *mut _IO_wide_data,
77 pub _freeres_list: *mut _IO_FILE,
78 pub _freeres_buf: *mut ::core::ffi::c_void,
79 pub __pad5: usize,
80 pub _mode: ::core::ffi::c_int,
81 pub _unused2: [::core::ffi::c_char; 20usize],
82}
83#[allow(clippy::unnecessary_operation, clippy::identity_op)]
84const _: () = {
85 ["Size of _IO_FILE"][::core::mem::size_of::<_IO_FILE>() - 216usize];
86 ["Alignment of _IO_FILE"][::core::mem::align_of::<_IO_FILE>() - 8usize];
87 ["Offset of field: _IO_FILE::_flags"][::core::mem::offset_of!(_IO_FILE, _flags) - 0usize];
88 ["Offset of field: _IO_FILE::_IO_read_ptr"]
89 [::core::mem::offset_of!(_IO_FILE, _IO_read_ptr) - 8usize];
90 ["Offset of field: _IO_FILE::_IO_read_end"]
91 [::core::mem::offset_of!(_IO_FILE, _IO_read_end) - 16usize];
92 ["Offset of field: _IO_FILE::_IO_read_base"]
93 [::core::mem::offset_of!(_IO_FILE, _IO_read_base) - 24usize];
94 ["Offset of field: _IO_FILE::_IO_write_base"]
95 [::core::mem::offset_of!(_IO_FILE, _IO_write_base) - 32usize];
96 ["Offset of field: _IO_FILE::_IO_write_ptr"]
97 [::core::mem::offset_of!(_IO_FILE, _IO_write_ptr) - 40usize];
98 ["Offset of field: _IO_FILE::_IO_write_end"]
99 [::core::mem::offset_of!(_IO_FILE, _IO_write_end) - 48usize];
100 ["Offset of field: _IO_FILE::_IO_buf_base"]
101 [::core::mem::offset_of!(_IO_FILE, _IO_buf_base) - 56usize];
102 ["Offset of field: _IO_FILE::_IO_buf_end"]
103 [::core::mem::offset_of!(_IO_FILE, _IO_buf_end) - 64usize];
104 ["Offset of field: _IO_FILE::_IO_save_base"]
105 [::core::mem::offset_of!(_IO_FILE, _IO_save_base) - 72usize];
106 ["Offset of field: _IO_FILE::_IO_backup_base"]
107 [::core::mem::offset_of!(_IO_FILE, _IO_backup_base) - 80usize];
108 ["Offset of field: _IO_FILE::_IO_save_end"]
109 [::core::mem::offset_of!(_IO_FILE, _IO_save_end) - 88usize];
110 ["Offset of field: _IO_FILE::_markers"][::core::mem::offset_of!(_IO_FILE, _markers) - 96usize];
111 ["Offset of field: _IO_FILE::_chain"][::core::mem::offset_of!(_IO_FILE, _chain) - 104usize];
112 ["Offset of field: _IO_FILE::_fileno"][::core::mem::offset_of!(_IO_FILE, _fileno) - 112usize];
113 ["Offset of field: _IO_FILE::_flags2"][::core::mem::offset_of!(_IO_FILE, _flags2) - 116usize];
114 ["Offset of field: _IO_FILE::_old_offset"]
115 [::core::mem::offset_of!(_IO_FILE, _old_offset) - 120usize];
116 ["Offset of field: _IO_FILE::_cur_column"]
117 [::core::mem::offset_of!(_IO_FILE, _cur_column) - 128usize];
118 ["Offset of field: _IO_FILE::_vtable_offset"]
119 [::core::mem::offset_of!(_IO_FILE, _vtable_offset) - 130usize];
120 ["Offset of field: _IO_FILE::_shortbuf"]
121 [::core::mem::offset_of!(_IO_FILE, _shortbuf) - 131usize];
122 ["Offset of field: _IO_FILE::_lock"][::core::mem::offset_of!(_IO_FILE, _lock) - 136usize];
123 ["Offset of field: _IO_FILE::_offset"][::core::mem::offset_of!(_IO_FILE, _offset) - 144usize];
124 ["Offset of field: _IO_FILE::_codecvt"][::core::mem::offset_of!(_IO_FILE, _codecvt) - 152usize];
125 ["Offset of field: _IO_FILE::_wide_data"]
126 [::core::mem::offset_of!(_IO_FILE, _wide_data) - 160usize];
127 ["Offset of field: _IO_FILE::_freeres_list"]
128 [::core::mem::offset_of!(_IO_FILE, _freeres_list) - 168usize];
129 ["Offset of field: _IO_FILE::_freeres_buf"]
130 [::core::mem::offset_of!(_IO_FILE, _freeres_buf) - 176usize];
131 ["Offset of field: _IO_FILE::__pad5"][::core::mem::offset_of!(_IO_FILE, __pad5) - 184usize];
132 ["Offset of field: _IO_FILE::_mode"][::core::mem::offset_of!(_IO_FILE, _mode) - 192usize];
133 ["Offset of field: _IO_FILE::_unused2"][::core::mem::offset_of!(_IO_FILE, _unused2) - 196usize];
134};
135impl Default for _IO_FILE {
136 fn default() -> Self {
137 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
138 unsafe {
139 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
140 s.assume_init()
141 }
142 }
143}
144pub type va_list = __gnuc_va_list;
145unsafe extern "C" {
146 pub fn rt_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
147}
148unsafe extern "C" {
149 pub fn Bela_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
150}
151#[doc = "< No hardware"]
152pub const BelaHw_BelaHw_NoHw: BelaHw = -1;
153#[doc = "< Bela"]
154pub const BelaHw_BelaHw_Bela: BelaHw = 0;
155#[doc = "< Bela Mini"]
156pub const BelaHw_BelaHw_BelaMini: BelaHw = 1;
157#[doc = "< Gem Stereo"]
158pub const BelaHw_BelaHw_GemStereo: BelaHw = 2;
159#[doc = "< Gem Multi"]
160pub const BelaHw_BelaHw_GemMulti: BelaHw = 3;
161#[doc = "< Salt"]
162pub const BelaHw_BelaHw_Salt: BelaHw = 4;
163#[doc = "< Ctag Face"]
164pub const BelaHw_BelaHw_CtagFace: BelaHw = 5;
165#[doc = "< Ctag Beast"]
166pub const BelaHw_BelaHw_CtagBeast: BelaHw = 6;
167#[doc = "< Ctag Face and Bela cape"]
168pub const BelaHw_BelaHw_CtagFaceBela: BelaHw = 7;
169#[doc = "< Ctag Beast and Bela cape"]
170pub const BelaHw_BelaHw_CtagBeastBela: BelaHw = 8;
171#[doc = "< Bela Mini with extra codecs"]
172pub const BelaHw_BelaHw_BelaMiniMultiAudio: BelaHw = 9;
173#[doc = "< Bela Mini with extra codecs and/or tdm devices"]
174pub const BelaHw_BelaHw_BelaMiniMultiTdm: BelaHw = 10;
175#[doc = "< Bela with extra codecs and/or tdm devices"]
176pub const BelaHw_BelaHw_BelaMultiTdm: BelaHw = 11;
177#[doc = "< Bela Mini with extra rx and tx I2S data lines."]
178pub const BelaHw_BelaHw_BelaMiniMultiI2s: BelaHw = 12;
179#[doc = "< A Bela cape with Es9080 EVB on top, all as audio"]
180pub const BelaHw_BelaHw_BelaEs9080: BelaHw = 13;
181#[doc = "< A Bela cape rev C: Es9080 is used for analog outs"]
182pub const BelaHw_BelaHw_BelaRevC: BelaHw = 14;
183#[doc = "< Dummy offline"]
184pub const BelaHw_BelaHw_Batch: BelaHw = 15;
185#[doc = " A type of Bela hardware."]
186pub type BelaHw = ::core::ffi::c_int;
187#[repr(C)]
188#[derive(Debug, Default, Copy, Clone)]
189pub struct _BelaHwConfig {
190 pub audioSampleRate: f32,
191 pub audioInChannels: ::core::ffi::c_uint,
192 pub audioOutChannels: ::core::ffi::c_uint,
193 pub analogInChannels: ::core::ffi::c_uint,
194 pub analogOutChannels: ::core::ffi::c_uint,
195 pub digitalChannels: ::core::ffi::c_uint,
196}
197#[allow(clippy::unnecessary_operation, clippy::identity_op)]
198const _: () = {
199 ["Size of _BelaHwConfig"][::core::mem::size_of::<_BelaHwConfig>() - 24usize];
200 ["Alignment of _BelaHwConfig"][::core::mem::align_of::<_BelaHwConfig>() - 4usize];
201 ["Offset of field: _BelaHwConfig::audioSampleRate"]
202 [::core::mem::offset_of!(_BelaHwConfig, audioSampleRate) - 0usize];
203 ["Offset of field: _BelaHwConfig::audioInChannels"]
204 [::core::mem::offset_of!(_BelaHwConfig, audioInChannels) - 4usize];
205 ["Offset of field: _BelaHwConfig::audioOutChannels"]
206 [::core::mem::offset_of!(_BelaHwConfig, audioOutChannels) - 8usize];
207 ["Offset of field: _BelaHwConfig::analogInChannels"]
208 [::core::mem::offset_of!(_BelaHwConfig, analogInChannels) - 12usize];
209 ["Offset of field: _BelaHwConfig::analogOutChannels"]
210 [::core::mem::offset_of!(_BelaHwConfig, analogOutChannels) - 16usize];
211 ["Offset of field: _BelaHwConfig::digitalChannels"]
212 [::core::mem::offset_of!(_BelaHwConfig, digitalChannels) - 20usize];
213};
214pub type BelaHwConfig = _BelaHwConfig;
215unsafe extern "C" {
216 #[doc = " Returns the configuration for a given BelaHw or `nullptr` if `hw` is\n invalid.\n\n The returned pointer has to be deleted with Bela_HwConfig_delete()."]
217 pub fn Bela_HwConfig_new(hw: BelaHw) -> *mut BelaHwConfig;
218}
219unsafe extern "C" {
220 #[doc = " Use this to delete a pointer returned by Bela_HwConfig_new()"]
221 pub fn Bela_HwConfig_delete(cfg: *mut BelaHwConfig);
222}
223#[doc = "< perform an automatic detection by scanning the peripherals and busses available, and cache value in `/run/bela/belaconfig`"]
224pub const BelaHwDetectMode_BelaHwDetectMode_Scan: BelaHwDetectMode = 0;
225#[doc = "< read cached value from `/run/bela/belaconfig` first. If it does not exist, fall back to #BelaHwDetectMode_Scan"]
226pub const BelaHwDetectMode_BelaHwDetectMode_Cache: BelaHwDetectMode = 1;
227#[doc = "<read cached value from `/run/bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
228pub const BelaHwDetectMode_BelaHwDetectMode_CacheOnly: BelaHwDetectMode = 2;
229#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, fall back to #BelaHwDetectMode_Cache"]
230pub const BelaHwDetectMode_BelaHwDetectMode_User: BelaHwDetectMode = 3;
231#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
232pub const BelaHwDetectMode_BelaHwDetectMode_UserOnly: BelaHwDetectMode = 4;
233#[doc = " Arguments to be passed to Bela_detectHw()"]
234pub type BelaHwDetectMode = ::core::ffi::c_uint;
235#[repr(C)]
236#[derive(Debug, Copy, Clone)]
237pub struct option {
238 _unused: [u8; 0],
239}
240#[doc = " \\ingroup render\n \\brief Structure holding audio and sensor settings and pointers to I/O data buffers.\n\n This structure is passed to setup(), render() and cleanup() and provides access to\n Bela's I/O functionality. It is initialised in Bela_initAudio() based on the contents\n of the BelaInitSettings structure."]
241#[repr(C)]
242#[derive(Debug, Copy, Clone)]
243pub struct BelaContext {
244 #[doc = " \\brief Buffer holding audio input samples\n\n This buffer allows Bela's audio input data to be read during render().\n By default the buffer contains data from all the audio input channels arranged\n in interleaved format.\n\n Every time render() runs this buffer is filled with a block of new audio samples.\n The block is made up of frames, individual slices of time consisting of one sample\n taken from each audio input channel simultaneously. The number of frames per\n block is given by context->audioFrames, and the number of audio input channels\n by context->audioInChannels. The length of this buffer is the product of these\n two values.\n\n The buffer can be accessed manually with standard array notation or more\n conveniently using the audioRead() utility.\n\n \\b Note: this element is available in render() only."]
245 pub audioIn: *const f32,
246 #[doc = " \\brief Buffer holding audio output samples\n\n This buffer allows Bela's audio output data to be written during render().\n By default the buffer must contain data from all the audio output channels\n arranged in interleaved format.\n\n Every time render() runs it is the job of the developer to fill this buffer with\n a block of new audio samples, structured in the same way as context->audioIn.\n\n The buffer can be accessed manually with standard array notation or more\n conveniently using the audioWrite() utility.\n\n \\b Note: this element is available in render() only."]
247 pub audioOut: *mut f32,
248 #[doc = " \\brief Buffer holding analog input samples\n\n This buffer allows Bela's analog input data to be read during render().\n By default the buffer contains data from all the analog input channels arranged\n in interleaved format.\n\n Every time render() runs this buffer is filled with a block of new analog samples.\n The block is made up of frames, individual slices of time consisting of one sample\n taken from each analog input channel simultaneously. The number of frames per\n block is given by context->analogFrames, and the number of analog input channels\n by context->analogInChannels. The length of this buffer is the product of these\n two values.\n\n The buffer can be accessed manually with standard array notation or more\n conveniently using the analogRead() utility.\n\n \\b Note: this element is available in render() only."]
249 pub analogIn: *const f32,
250 #[doc = " \\brief Buffer holding analog output samples\n\n This buffer allows Bela's analog output data to be written during render().\n By default the buffer must contain data from all the analog output channels\n arranged in interleaved format.\n\n Every time render() runs it is the job of the developer to fill this buffer with\n a block of new analog samples, structured in the same way as context->analogIn.\n\n The buffer can be accessed manually with standard array notation or more\n conveniently using the analogWrite() utility.\n\n \\b Note: this element is available in render() only."]
251 pub analogOut: *mut f32,
252 #[doc = " \\brief Buffer holding digital input/output samples\n\n This buffer allows Bela's digital GPIO data to be read and written during render().\n\n The buffer can be accessed manually with standard array notation or somewhat more\n conveniently using the digitalRead() and digitalWrite() utilities.\n\n \\b Note: this element is available in render() only."]
253 pub digital: *mut u32,
254 #[doc = " \\brief The number of audio frames per block\n\n Every time render() runs context->audioIn is filled with a block of new audio\n samples. The block is made up of frames, individual slices of time consisting of\n one sample taken from each audio input channel simultaneously.\n\n This value determines the number of audio frames in each block and can be adjusted\n in the IDE settings tab (or via the command line arguments) from 2 to 128,\n defaulting to 16.\n\n This value also determines how often render() is called, and reducing it decreases\n audio latency at the cost of increased CPU consumption."]
255 pub audioFrames: u32,
256 #[doc = " \\brief The number of audio input channels"]
257 pub audioInChannels: u32,
258 #[doc = " \\brief The number of audio output channels"]
259 pub audioOutChannels: u32,
260 #[doc = " \\brief The audio sample rate in Hz"]
261 pub audioSampleRate: f32,
262 #[doc = " \\brief The number of analog frames per block\n\n Every time render() runs context->analogIn is filled with a block of new analog\n samples. The block is made up of frames, individual slices of time consisting of\n one sample taken from each analog input channel simultaneously.\n\n This value determines the number of analog frames in each block. It cannot be\n set directly as it is dependant on the number of audio frames per block\n (context->audioFrames) and the analog sample rate (context->analogSampleRate).\n\n This value will be 0 if analog I/O is disabled."]
263 pub analogFrames: u32,
264 #[doc = " \\brief The number of analog input channels\n\n This will be 0 if analog I/O is disabled."]
265 pub analogInChannels: u32,
266 #[doc = " \\brief The number of analog output channels\n\n This will be 0 if analog I/O is disabled."]
267 pub analogOutChannels: u32,
268 #[doc = " \\brief Analog sample rate in Hz\n\n This value determines the rate at which each analog input is sampled, and is\n directly related to the number of analog channels available. It can be adjusted\n in the IDE settings tab (or via the command line arguments) to 22050, 44100\n or 88200, allowing 8, 4, or 2 analog channels respectively. By default, all 8\n channels are sampled at 22050Hz.\n\n If analog I/O is disabled, this value is 0."]
269 pub analogSampleRate: f32,
270 #[doc = " Number of digital frames per period"]
271 pub digitalFrames: u32,
272 #[doc = " \\brief Number of digital channels\n\n Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0."]
273 pub digitalChannels: u32,
274 #[doc = " Digital sample rate in Hz (currently always 44100.0)"]
275 pub digitalSampleRate: f32,
276 #[doc = " \\brief Number of elapsed audio frames since the start of rendering.\n\n This holds the total number of audio frames as of the beginning of the current block. To\n find the current number of analog or digital frames elapsed, multiply by the ratio of the\n sample rates (e.g. half the number of analog frames will have elapsed if the analog sample\n rate is 22050)."]
277 pub audioFramesElapsed: u64,
278 #[doc = " \\brief Number of multiplexer channels for each analog input.\n\n This will be 2, 4 or 8 if the multiplexer capelet is enabled, otherwise it will be 1.\n 2, 4 and 8 correspond to 16, 32 and 64 analog inputs, respectively."]
279 pub multiplexerChannels: u32,
280 #[doc = " \\brief Multiplexer channel corresponding to the first analog frame.\n\n This indicates the multiplexer setting corresponding to the first analog frame in the\n buffer."]
281 pub multiplexerStartingChannel: u32,
282 #[doc = " \\brief Buffer which holds multiplexed analog inputs, when multiplexer capelet is enabled.\n\n Because the analog in buffer size may be smaller than a complete cycle of the multiplexer\n capelet, this buffer will always be big enough to hold at least one complete cycle of all\n channels. It will be null if the multiplexer capelet is not enabled."]
283 pub multiplexerAnalogIn: *const f32,
284 #[doc = " \\brief Flags for whether audio expander is enabled on given analog channels.\n\n Bits 0-15, when set, indicate audio expander enabled on the analog inputs. Bits 16-31\n indicate audio expander enabled on the analog outputs."]
285 pub audioExpanderEnabled: u32,
286 #[doc = " \\brief Other audio/sensor settings\n\n Binary combination of flags including:\n\n BELA_FLAG_INTERLEAVED\n BELA_FLAG_ANALOG_OUTPUTS_PERSIST\n BELA_FLAG_DETECT_UNDERRUNS\n BELA_FLAG_OFFLINE"]
287 pub flags: u32,
288 #[doc = " Name of running project."]
289 pub projectName: [::core::ffi::c_char; 256usize],
290 #[doc = " Number of detected underruns."]
291 pub underrunCount: ::core::ffi::c_uint,
292 #[doc = " \\brief Which thread this context is running on.\n\n Used for multithreaded rendering. Values range from 0 to (threadCount - 1)."]
293 pub thisThread: u32,
294 #[doc = " \\brief Total number of threads in use for render()\n\n Used for multithreaded rendering."]
295 pub threadCount: u32,
296}
297#[allow(clippy::unnecessary_operation, clippy::identity_op)]
298const _: () = {
299 ["Size of BelaContext"][::core::mem::size_of::<BelaContext>() - 392usize];
300 ["Alignment of BelaContext"][::core::mem::align_of::<BelaContext>() - 8usize];
301 ["Offset of field: BelaContext::audioIn"]
302 [::core::mem::offset_of!(BelaContext, audioIn) - 0usize];
303 ["Offset of field: BelaContext::audioOut"]
304 [::core::mem::offset_of!(BelaContext, audioOut) - 8usize];
305 ["Offset of field: BelaContext::analogIn"]
306 [::core::mem::offset_of!(BelaContext, analogIn) - 16usize];
307 ["Offset of field: BelaContext::analogOut"]
308 [::core::mem::offset_of!(BelaContext, analogOut) - 24usize];
309 ["Offset of field: BelaContext::digital"]
310 [::core::mem::offset_of!(BelaContext, digital) - 32usize];
311 ["Offset of field: BelaContext::audioFrames"]
312 [::core::mem::offset_of!(BelaContext, audioFrames) - 40usize];
313 ["Offset of field: BelaContext::audioInChannels"]
314 [::core::mem::offset_of!(BelaContext, audioInChannels) - 44usize];
315 ["Offset of field: BelaContext::audioOutChannels"]
316 [::core::mem::offset_of!(BelaContext, audioOutChannels) - 48usize];
317 ["Offset of field: BelaContext::audioSampleRate"]
318 [::core::mem::offset_of!(BelaContext, audioSampleRate) - 52usize];
319 ["Offset of field: BelaContext::analogFrames"]
320 [::core::mem::offset_of!(BelaContext, analogFrames) - 56usize];
321 ["Offset of field: BelaContext::analogInChannels"]
322 [::core::mem::offset_of!(BelaContext, analogInChannels) - 60usize];
323 ["Offset of field: BelaContext::analogOutChannels"]
324 [::core::mem::offset_of!(BelaContext, analogOutChannels) - 64usize];
325 ["Offset of field: BelaContext::analogSampleRate"]
326 [::core::mem::offset_of!(BelaContext, analogSampleRate) - 68usize];
327 ["Offset of field: BelaContext::digitalFrames"]
328 [::core::mem::offset_of!(BelaContext, digitalFrames) - 72usize];
329 ["Offset of field: BelaContext::digitalChannels"]
330 [::core::mem::offset_of!(BelaContext, digitalChannels) - 76usize];
331 ["Offset of field: BelaContext::digitalSampleRate"]
332 [::core::mem::offset_of!(BelaContext, digitalSampleRate) - 80usize];
333 ["Offset of field: BelaContext::audioFramesElapsed"]
334 [::core::mem::offset_of!(BelaContext, audioFramesElapsed) - 88usize];
335 ["Offset of field: BelaContext::multiplexerChannels"]
336 [::core::mem::offset_of!(BelaContext, multiplexerChannels) - 96usize];
337 ["Offset of field: BelaContext::multiplexerStartingChannel"]
338 [::core::mem::offset_of!(BelaContext, multiplexerStartingChannel) - 100usize];
339 ["Offset of field: BelaContext::multiplexerAnalogIn"]
340 [::core::mem::offset_of!(BelaContext, multiplexerAnalogIn) - 104usize];
341 ["Offset of field: BelaContext::audioExpanderEnabled"]
342 [::core::mem::offset_of!(BelaContext, audioExpanderEnabled) - 112usize];
343 ["Offset of field: BelaContext::flags"][::core::mem::offset_of!(BelaContext, flags) - 116usize];
344 ["Offset of field: BelaContext::projectName"]
345 [::core::mem::offset_of!(BelaContext, projectName) - 120usize];
346 ["Offset of field: BelaContext::underrunCount"]
347 [::core::mem::offset_of!(BelaContext, underrunCount) - 376usize];
348 ["Offset of field: BelaContext::thisThread"]
349 [::core::mem::offset_of!(BelaContext, thisThread) - 380usize];
350 ["Offset of field: BelaContext::threadCount"]
351 [::core::mem::offset_of!(BelaContext, threadCount) - 384usize];
352};
353impl Default for BelaContext {
354 fn default() -> Self {
355 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
356 unsafe {
357 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
358 s.assume_init()
359 }
360 }
361}
362#[repr(C)]
363#[derive(Debug, Default, Copy, Clone)]
364pub struct BelaChannelGain {
365 #[doc = "< Channel number. Negative value means all the channels"]
366 pub channel: ::core::ffi::c_int,
367 #[doc = "< Gain in dB."]
368 pub gain: f32,
369}
370#[allow(clippy::unnecessary_operation, clippy::identity_op)]
371const _: () = {
372 ["Size of BelaChannelGain"][::core::mem::size_of::<BelaChannelGain>() - 8usize];
373 ["Alignment of BelaChannelGain"][::core::mem::align_of::<BelaChannelGain>() - 4usize];
374 ["Offset of field: BelaChannelGain::channel"]
375 [::core::mem::offset_of!(BelaChannelGain, channel) - 0usize];
376 ["Offset of field: BelaChannelGain::gain"]
377 [::core::mem::offset_of!(BelaChannelGain, gain) - 4usize];
378};
379#[repr(C)]
380#[derive(Debug, Copy, Clone)]
381pub struct BelaChannelGainArray {
382 pub length: ::core::ffi::c_uint,
383 pub data: *mut BelaChannelGain,
384}
385#[allow(clippy::unnecessary_operation, clippy::identity_op)]
386const _: () = {
387 ["Size of BelaChannelGainArray"][::core::mem::size_of::<BelaChannelGainArray>() - 16usize];
388 ["Alignment of BelaChannelGainArray"][::core::mem::align_of::<BelaChannelGainArray>() - 8usize];
389 ["Offset of field: BelaChannelGainArray::length"]
390 [::core::mem::offset_of!(BelaChannelGainArray, length) - 0usize];
391 ["Offset of field: BelaChannelGainArray::data"]
392 [::core::mem::offset_of!(BelaChannelGainArray, data) - 8usize];
393};
394impl Default for BelaChannelGainArray {
395 fn default() -> Self {
396 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
397 unsafe {
398 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
399 s.assume_init()
400 }
401 }
402}
403#[doc = " \\ingroup control\n \\brief Structure containing initialisation parameters for the real-time\n audio control system.\n\n This structure is initialised using Bela_defaultSettings(). Its contents\n are used up through the point of calling\n Bela_initAudio() at which point it is no longer needed."]
404#[repr(C)]
405#[derive(Debug, Copy, Clone)]
406pub struct BelaInitSettings {
407 #[doc = " \\brief Number of audio frames per period (\"blocksize\").\n\n The number of analog frames depends on relative sample rates of the\n two. By default, audio is twice the sample rate, so has twice the\n period size."]
408 pub periodSize: ::core::ffi::c_int,
409 #[doc = " Whether to use the analog input and output"]
410 pub useAnalog: ::core::ffi::c_int,
411 #[doc = " Whether to use the 16 programmable GPIOs"]
412 pub useDigital: ::core::ffi::c_int,
413 #[doc = " How many audio input channels [ignored]"]
414 pub numAudioInChannels: ::core::ffi::c_int,
415 #[doc = " How many audio out channels [ignored]"]
416 pub numAudioOutChannels: ::core::ffi::c_int,
417 #[doc = " How many analog input channels"]
418 pub numAnalogInChannels: ::core::ffi::c_int,
419 #[doc = " How many analog output channels"]
420 pub numAnalogOutChannels: ::core::ffi::c_int,
421 #[doc = " How many channels for the GPIOs"]
422 pub numDigitalChannels: ::core::ffi::c_int,
423 #[doc = " Whether to begin with the speakers muted"]
424 pub beginMuted: ::core::ffi::c_int,
425 #[doc = " Level for the audio DAC output. DEPRECATED: ues lineOutGains"]
426 pub dacLevel: f32,
427 #[doc = " Level for the audio ADC input. DEPRECATED: use audioInputGains"]
428 pub adcLevel: f32,
429 #[doc = " Gains for the PGA, left and right channels. DEPRECATED: use audioInputGains"]
430 pub pgaGain: [f32; 2usize],
431 #[doc = " Level for the headphone output. DEPRECATED: use headphoneGains"]
432 pub headphoneLevel: f32,
433 #[doc = " How many channels to use on the multiplexer capelet, if enabled"]
434 pub numMuxChannels: ::core::ffi::c_int,
435 #[doc = " Which audio expander settings to use on the input"]
436 pub audioExpanderInputs: ::core::ffi::c_uint,
437 #[doc = " Which audio expander settings to use on the input"]
438 pub audioExpanderOutputs: ::core::ffi::c_uint,
439 #[doc = " Which PRU (0 or 1) the code should run on"]
440 pub pruNumber: ::core::ffi::c_int,
441 #[doc = " The external .bin file to load. If empty will use PRU code from pru_rtaudio_bin.h"]
442 pub pruFilename: [::core::ffi::c_char; 256usize],
443 #[doc = " Whether to detect and log underruns"]
444 pub detectUnderruns: ::core::ffi::c_int,
445 #[doc = " Whether to use verbose logging"]
446 pub verbose: ::core::ffi::c_int,
447 #[doc = " Whether to use the blinking LED to indicate Bela is running"]
448 pub enableLED: ::core::ffi::c_int,
449 #[doc = " What GPIO pin to monitor for stopping the program. Defaults to 115\n (button on P9.27/P2.34/GPIO3[19]). Pass -1 to disable monitoring."]
450 pub stopButtonPin: ::core::ffi::c_int,
451 #[doc = " Whether to use high-performance mode: gives more CPU to\n the Bela task. The Linux part of the board and the IDE may\n freeze while the program is running. Use the button on the\n Bela cape to forcefully stop the running program"]
452 pub highPerformanceMode: ::core::ffi::c_int,
453 #[doc = " Whether audio/analog data should be interleaved"]
454 pub interleave: ::core::ffi::c_int,
455 #[doc = " \\brief Whether analog outputs should persist to future frames.\n\n n.b. digital pins always persist, audio never does"]
456 pub analogOutputsPersist: ::core::ffi::c_int,
457 #[doc = " \\brief Whether the analog channels should be resampled to\n audio sampling rate."]
458 pub uniformSampleRate: ::core::ffi::c_int,
459 #[doc = " \\brief The requested stack size for the audio thread. Defaults"]
460 pub audioThreadStackSize: ::core::ffi::c_uint,
461 #[doc = " \\brief The requested stack size for each AuxilaryTask. Defaults"]
462 pub auxiliaryTaskStackSize: ::core::ffi::c_uint,
463 #[doc = " Pointers to the user-defined functions"]
464 pub setup: ::core::option::Option<
465 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void) -> bool,
466 >,
467 pub render: ::core::option::Option<
468 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
469 >,
470 pub cleanup: ::core::option::Option<
471 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
472 >,
473 #[doc = " Pin where amplifier mute can be found"]
474 pub ampMutePin: ::core::ffi::c_int,
475 #[doc = " Pointer to an optional function to be called when the audio thread is done.\n This function is called from the audio thread itself just before it returns."]
476 pub audioThreadDone: ::core::option::Option<
477 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
478 >,
479 #[doc = " A codec-specific intialisation parameter"]
480 pub codecMode: *mut ::core::ffi::c_char,
481 #[doc = " audio input gains"]
482 pub audioInputGains: BelaChannelGainArray,
483 #[doc = " level for headphone outputs"]
484 pub headphoneGains: BelaChannelGainArray,
485 #[doc = " Level for the audio ADC input DEPRECATED: use audioInputGains"]
486 pub adcGains: BelaChannelGainArray,
487 #[doc = " Level for the audio line level output"]
488 pub lineOutGains: BelaChannelGainArray,
489 #[doc = " A bitmask of disabled digital channels"]
490 pub disabledDigitalChannels: u32,
491 #[doc = " Number of parallel render threads to run"]
492 pub threadCount: ::core::ffi::c_uint,
493 #[doc = " More pointers to the user-defined functions"]
494 pub render_pre: ::core::option::Option<
495 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
496 >,
497 pub render_post: ::core::option::Option<
498 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
499 >,
500 #[doc = " The audio sample rate in Hz"]
501 pub audioSampleRate: f32,
502 #[doc = " User selected board to work with (as opposed to detected hardware)."]
503 pub board: BelaHw,
504 #[doc = " Name of running project."]
505 pub projectName: *mut ::core::ffi::c_char,
506}
507#[allow(clippy::unnecessary_operation, clippy::identity_op)]
508const _: () = {
509 ["Size of BelaInitSettings"][::core::mem::size_of::<BelaInitSettings>() - 520usize];
510 ["Alignment of BelaInitSettings"][::core::mem::align_of::<BelaInitSettings>() - 8usize];
511 ["Offset of field: BelaInitSettings::periodSize"]
512 [::core::mem::offset_of!(BelaInitSettings, periodSize) - 0usize];
513 ["Offset of field: BelaInitSettings::useAnalog"]
514 [::core::mem::offset_of!(BelaInitSettings, useAnalog) - 4usize];
515 ["Offset of field: BelaInitSettings::useDigital"]
516 [::core::mem::offset_of!(BelaInitSettings, useDigital) - 8usize];
517 ["Offset of field: BelaInitSettings::numAudioInChannels"]
518 [::core::mem::offset_of!(BelaInitSettings, numAudioInChannels) - 12usize];
519 ["Offset of field: BelaInitSettings::numAudioOutChannels"]
520 [::core::mem::offset_of!(BelaInitSettings, numAudioOutChannels) - 16usize];
521 ["Offset of field: BelaInitSettings::numAnalogInChannels"]
522 [::core::mem::offset_of!(BelaInitSettings, numAnalogInChannels) - 20usize];
523 ["Offset of field: BelaInitSettings::numAnalogOutChannels"]
524 [::core::mem::offset_of!(BelaInitSettings, numAnalogOutChannels) - 24usize];
525 ["Offset of field: BelaInitSettings::numDigitalChannels"]
526 [::core::mem::offset_of!(BelaInitSettings, numDigitalChannels) - 28usize];
527 ["Offset of field: BelaInitSettings::beginMuted"]
528 [::core::mem::offset_of!(BelaInitSettings, beginMuted) - 32usize];
529 ["Offset of field: BelaInitSettings::dacLevel"]
530 [::core::mem::offset_of!(BelaInitSettings, dacLevel) - 36usize];
531 ["Offset of field: BelaInitSettings::adcLevel"]
532 [::core::mem::offset_of!(BelaInitSettings, adcLevel) - 40usize];
533 ["Offset of field: BelaInitSettings::pgaGain"]
534 [::core::mem::offset_of!(BelaInitSettings, pgaGain) - 44usize];
535 ["Offset of field: BelaInitSettings::headphoneLevel"]
536 [::core::mem::offset_of!(BelaInitSettings, headphoneLevel) - 52usize];
537 ["Offset of field: BelaInitSettings::numMuxChannels"]
538 [::core::mem::offset_of!(BelaInitSettings, numMuxChannels) - 56usize];
539 ["Offset of field: BelaInitSettings::audioExpanderInputs"]
540 [::core::mem::offset_of!(BelaInitSettings, audioExpanderInputs) - 60usize];
541 ["Offset of field: BelaInitSettings::audioExpanderOutputs"]
542 [::core::mem::offset_of!(BelaInitSettings, audioExpanderOutputs) - 64usize];
543 ["Offset of field: BelaInitSettings::pruNumber"]
544 [::core::mem::offset_of!(BelaInitSettings, pruNumber) - 68usize];
545 ["Offset of field: BelaInitSettings::pruFilename"]
546 [::core::mem::offset_of!(BelaInitSettings, pruFilename) - 72usize];
547 ["Offset of field: BelaInitSettings::detectUnderruns"]
548 [::core::mem::offset_of!(BelaInitSettings, detectUnderruns) - 328usize];
549 ["Offset of field: BelaInitSettings::verbose"]
550 [::core::mem::offset_of!(BelaInitSettings, verbose) - 332usize];
551 ["Offset of field: BelaInitSettings::enableLED"]
552 [::core::mem::offset_of!(BelaInitSettings, enableLED) - 336usize];
553 ["Offset of field: BelaInitSettings::stopButtonPin"]
554 [::core::mem::offset_of!(BelaInitSettings, stopButtonPin) - 340usize];
555 ["Offset of field: BelaInitSettings::highPerformanceMode"]
556 [::core::mem::offset_of!(BelaInitSettings, highPerformanceMode) - 344usize];
557 ["Offset of field: BelaInitSettings::interleave"]
558 [::core::mem::offset_of!(BelaInitSettings, interleave) - 348usize];
559 ["Offset of field: BelaInitSettings::analogOutputsPersist"]
560 [::core::mem::offset_of!(BelaInitSettings, analogOutputsPersist) - 352usize];
561 ["Offset of field: BelaInitSettings::uniformSampleRate"]
562 [::core::mem::offset_of!(BelaInitSettings, uniformSampleRate) - 356usize];
563 ["Offset of field: BelaInitSettings::audioThreadStackSize"]
564 [::core::mem::offset_of!(BelaInitSettings, audioThreadStackSize) - 360usize];
565 ["Offset of field: BelaInitSettings::auxiliaryTaskStackSize"]
566 [::core::mem::offset_of!(BelaInitSettings, auxiliaryTaskStackSize) - 364usize];
567 ["Offset of field: BelaInitSettings::setup"]
568 [::core::mem::offset_of!(BelaInitSettings, setup) - 368usize];
569 ["Offset of field: BelaInitSettings::render"]
570 [::core::mem::offset_of!(BelaInitSettings, render) - 376usize];
571 ["Offset of field: BelaInitSettings::cleanup"]
572 [::core::mem::offset_of!(BelaInitSettings, cleanup) - 384usize];
573 ["Offset of field: BelaInitSettings::ampMutePin"]
574 [::core::mem::offset_of!(BelaInitSettings, ampMutePin) - 392usize];
575 ["Offset of field: BelaInitSettings::audioThreadDone"]
576 [::core::mem::offset_of!(BelaInitSettings, audioThreadDone) - 400usize];
577 ["Offset of field: BelaInitSettings::codecMode"]
578 [::core::mem::offset_of!(BelaInitSettings, codecMode) - 408usize];
579 ["Offset of field: BelaInitSettings::audioInputGains"]
580 [::core::mem::offset_of!(BelaInitSettings, audioInputGains) - 416usize];
581 ["Offset of field: BelaInitSettings::headphoneGains"]
582 [::core::mem::offset_of!(BelaInitSettings, headphoneGains) - 432usize];
583 ["Offset of field: BelaInitSettings::adcGains"]
584 [::core::mem::offset_of!(BelaInitSettings, adcGains) - 448usize];
585 ["Offset of field: BelaInitSettings::lineOutGains"]
586 [::core::mem::offset_of!(BelaInitSettings, lineOutGains) - 464usize];
587 ["Offset of field: BelaInitSettings::disabledDigitalChannels"]
588 [::core::mem::offset_of!(BelaInitSettings, disabledDigitalChannels) - 480usize];
589 ["Offset of field: BelaInitSettings::threadCount"]
590 [::core::mem::offset_of!(BelaInitSettings, threadCount) - 484usize];
591 ["Offset of field: BelaInitSettings::render_pre"]
592 [::core::mem::offset_of!(BelaInitSettings, render_pre) - 488usize];
593 ["Offset of field: BelaInitSettings::render_post"]
594 [::core::mem::offset_of!(BelaInitSettings, render_post) - 496usize];
595 ["Offset of field: BelaInitSettings::audioSampleRate"]
596 [::core::mem::offset_of!(BelaInitSettings, audioSampleRate) - 504usize];
597 ["Offset of field: BelaInitSettings::board"]
598 [::core::mem::offset_of!(BelaInitSettings, board) - 508usize];
599 ["Offset of field: BelaInitSettings::projectName"]
600 [::core::mem::offset_of!(BelaInitSettings, projectName) - 512usize];
601};
602impl Default for BelaInitSettings {
603 fn default() -> Self {
604 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
605 unsafe {
606 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
607 s.assume_init()
608 }
609 }
610}
611#[doc = " \\ingroup auxtask\n\n Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and\n automatically cleaned up after cleanup() finishes."]
612pub type AuxiliaryTask = *mut ::core::ffi::c_void;
613unsafe extern "C" {
614 #[doc = " \\brief Allocate the data structure containing settings for Bela.\n\n This function should be used to allocate the structure that holds initialisation\n data for Bela in order to preserve binary compatibility across versions of\n the library."]
615 pub fn Bela_InitSettings_alloc() -> *mut BelaInitSettings;
616}
617unsafe extern "C" {
618 #[doc = " \\brief De-allocate the data structure containing settings for Bela.\n\n This function should be used to de-allocate the structure that holds initialisation\n data for Bela.\n\n \\param settings Pointer to structure to be de-allocated."]
619 pub fn Bela_InitSettings_free(settings: *mut BelaInitSettings);
620}
621unsafe extern "C" {
622 #[doc = " \\brief Initialise the data structure containing settings for Bela.\n\n This function should be called in main() before parsing any command-line arguments. It\n sets default values in the data structure which specifies the Bela settings, including\n frame sizes, numbers of channels, volume levels and other parameters.\n\n \\param settings Structure holding initialisation data for Bela."]
623 pub fn Bela_defaultSettings(settings: *mut BelaInitSettings);
624}
625unsafe extern "C" {
626 #[doc = " \\brief Initialise the data structure containing settings for Bela.\n\n This function fwill be called by Bela_defaultSettings() after the settings have been\n initialied. It has weak linking so the user is free - but not forced to - define it.\n It can be used to override some of the default settings if the user code does not have\n access to the call to Bela_defaultSettings() (e.g.: because it is handled by the backend\n code).\n\n \\param settings Structure holding initialisation data for Bela."]
627 pub fn Bela_userSettings(settings: *mut BelaInitSettings);
628}
629unsafe extern "C" {
630 #[doc = " \\brief Get long options from command line argument list, including Bela standard options\n\n This function should be used in main() to process command line options, in place of the\n standard library getopt_long(). Internally, it parses standard Bela command-line options,\n storing the results in the settings data structure. Any options which are not part of the\n Bela standard options will be returned, as they would normally be in getopt_long().\n\n \\param argc Number of command line options, as passed to main().\n \\param argv Array of command line options, as passed to main().\n \\param customShortOptions List of short options to be parsed, analogous to getopt_long(). This\n list should not include any characters already parsed as part of the Bela standard options.\n \\param customLongOptions List of long options to parsed, analogous to getopt_long(). This\n list should not include any long options already parsed as part of the Bela standard options.\n \\param settings Data structure holding initialisation settings for Bela. Any standard options\n parsed will automatically update this data structure.\n\n \\return Value of the next option parsed which is not a Bela standard option, or -1 when the\n argument list has been exhausted. Similar to the return value of getopt_long() except that Bela\n standard options are handled internally and not returned."]
631 pub fn Bela_getopt_long(
632 argc: ::core::ffi::c_int,
633 argv: *const *mut ::core::ffi::c_char,
634 customShortOptions: *const ::core::ffi::c_char,
635 customLongOptions: *const option,
636 settings: *mut BelaInitSettings,
637 ) -> ::core::ffi::c_int;
638}
639unsafe extern "C" {
640 #[doc = " \\brief Print usage information for Bela standard options.\n\n This function should be called from your code wherever you wish to print usage information for the\n user. It will print usage information on Bela standard options, after which you can print usage\n information for your own custom options."]
641 pub fn Bela_usage();
642}
643unsafe extern "C" {
644 #[doc = " \\brief Get the version of Bela you are running."]
645 pub fn Bela_getVersion(
646 major: *mut ::core::ffi::c_int,
647 minor: *mut ::core::ffi::c_int,
648 bugfix: *mut ::core::ffi::c_int,
649 );
650}
651unsafe extern "C" {
652 #[doc = " \\brief Set level of verbose (debugging) printing.\n\n \\param level Verbosity level of the internal Bela system. 0 by default; higher values will\n print more information. Presently all positive numbers produce the same level of printing."]
653 pub fn Bela_setVerboseLevel(level: ::core::ffi::c_int);
654}
655unsafe extern "C" {
656 #[doc = " \\brief Detect what hardware we are running on.\n\n\n \\param mode How to perform the detection. The behaviour is described in #BelaHwDetectMode."]
657 pub fn Bela_detectHw(mode: BelaHwDetectMode) -> BelaHw;
658}
659unsafe extern "C" {
660 #[doc = " \\brief Initialise audio and sensor rendering environment.\n\n This function prepares audio rendering in Bela. It should be called from main() sometime\n after command line option parsing has finished. It will initialise the rendering system, which\n in the process will result in a call to the user-defined setup() function.\n\n \\param settings Data structure holding system settings, including numbers of channels, frame sizes,\n volume levels and other information.\n \\param userData An opaque pointer to a user-defined data structure which will be passed to\n setup(), render() and cleanup(). You can use this to pass custom information\n to the rendering functions, as an alternative to using global variables.\n\n \\return 0 on success, or nonzero if an error occurred."]
661 pub fn Bela_initAudio(
662 settings: *mut BelaInitSettings,
663 userData: *mut ::core::ffi::c_void,
664 ) -> ::core::ffi::c_int;
665}
666unsafe extern "C" {
667 #[doc = " \\brief Begin processing audio and sensor data.\n\n This function will start the Bela audio/sensor system. After this function is called, the\n system will make periodic calls to render() until Bela_stopAudio() is called.\n\n \\return 0 on success, or nonzero if an error occurred."]
668 pub fn Bela_startAudio() -> ::core::ffi::c_int;
669}
670unsafe extern "C" {
671 #[doc = " \\brief Begin processing audio and sensor data in the same thread as the caller.\n\n This function will start the Bela audio/sensor system. After this function is called, the\n system will make periodic calls to render() until Bela_stopAudio() is called.\n\n \\return 0 on success, or nonzero if an error occurred."]
672 pub fn Bela_runInSameThread() -> ::core::ffi::c_int;
673}
674unsafe extern "C" {
675 #[doc = " \\brief Stop processing audio and sensor data.\n\n This function will stop the Bela audio/sensor system. After this function returns, no further\n calls to render() will be issued."]
676 pub fn Bela_stopAudio();
677}
678unsafe extern "C" {
679 #[doc = " \\brief Clean up resources from audio and sensor processing.\n\n This function should only be called after Bela_stopAudio(). It will release any\n internal resources for audio and sensor processing. In the process, it will call the\n user-defined cleanup() function."]
680 pub fn Bela_cleanupAudio();
681}
682unsafe extern "C" {
683 #[doc = " \\brief Set the `userData` variable, which is passed to setup(), render() and cleanup().\n\n This function can be used to override `userData` after it has been set by Bela_initAudio().\n\n \\note This function is experimental and may be removed in a future version."]
684 pub fn Bela_setUserData(newUserData: *mut ::core::ffi::c_void);
685}
686unsafe extern "C" {
687 #[doc = " \\brief Tell the Bela program to stop.\n\n This can be safely called anywhere in the code to tell the audio thread, and\n all threads monitoring Bela_stopRequested() that they should stop at the\n earliest occasion. The program will not stop immediately. If the render()\n function is currently running, it will keep running until it concludes its\n current execution, but will not be called again. The program's execution\n will stop when all threads have completed their execution. For this reason,\n all threads should check for Bela_stopRequested() to be notified when\n Bela_requestStop() has been called."]
688 pub fn Bela_requestStop();
689}
690unsafe extern "C" {
691 #[doc = " \\brief Check whether the program should stop.\n\n If you have several threads of execution, each of them should be regularly\n calling this function and complete execution as soon as possible if a\n non-zero value is returned.\n\n @return a non-zero value if stop has been requested, 0 otherwise."]
692 pub fn Bela_stopRequested() -> ::core::ffi::c_int;
693}
694#[repr(C)]
695#[derive(Debug, Default, Copy, Clone)]
696pub struct timespec {
697 pub tv_sec: __time_t,
698 pub tv_nsec: __syscall_slong_t,
699}
700#[allow(clippy::unnecessary_operation, clippy::identity_op)]
701const _: () = {
702 ["Size of timespec"][::core::mem::size_of::<timespec>() - 16usize];
703 ["Alignment of timespec"][::core::mem::align_of::<timespec>() - 8usize];
704 ["Offset of field: timespec::tv_sec"][::core::mem::offset_of!(timespec, tv_sec) - 0usize];
705 ["Offset of field: timespec::tv_nsec"][::core::mem::offset_of!(timespec, tv_nsec) - 8usize];
706};
707pub type clockid_t = __clockid_t;
708#[repr(C)]
709#[derive(Debug, Default, Copy, Clone)]
710pub struct BelaCpuData {
711 #[doc = "< Number of samples (tic/toc pairs) in a acquisition cycle. Use 0 to disable."]
712 pub count: ::core::ffi::c_uint,
713 #[doc = "< Number of tics in current acquisition cycle"]
714 pub currentCount: ::core::ffi::c_uint,
715 #[doc = "< Total CPU time spent being busy (between tic and toc) during the current acquisition cycle"]
716 pub busy: ::core::ffi::c_ulonglong,
717 #[doc = "< Total CPU time (between tic and previous tic) during the current acquisition cycle"]
718 pub total: ::core::ffi::c_ulonglong,
719 #[doc = "< Time of last tic"]
720 pub tic: timespec,
721 #[doc = "< Time of last toc"]
722 pub toc: timespec,
723 #[doc = "< Average CPU usage during previous acquisition cycle"]
724 pub percentage: f32,
725}
726#[allow(clippy::unnecessary_operation, clippy::identity_op)]
727const _: () = {
728 ["Size of BelaCpuData"][::core::mem::size_of::<BelaCpuData>() - 64usize];
729 ["Alignment of BelaCpuData"][::core::mem::align_of::<BelaCpuData>() - 8usize];
730 ["Offset of field: BelaCpuData::count"][::core::mem::offset_of!(BelaCpuData, count) - 0usize];
731 ["Offset of field: BelaCpuData::currentCount"]
732 [::core::mem::offset_of!(BelaCpuData, currentCount) - 4usize];
733 ["Offset of field: BelaCpuData::busy"][::core::mem::offset_of!(BelaCpuData, busy) - 8usize];
734 ["Offset of field: BelaCpuData::total"][::core::mem::offset_of!(BelaCpuData, total) - 16usize];
735 ["Offset of field: BelaCpuData::tic"][::core::mem::offset_of!(BelaCpuData, tic) - 24usize];
736 ["Offset of field: BelaCpuData::toc"][::core::mem::offset_of!(BelaCpuData, toc) - 40usize];
737 ["Offset of field: BelaCpuData::percentage"]
738 [::core::mem::offset_of!(BelaCpuData, percentage) - 56usize];
739};
740unsafe extern "C" {
741 #[doc = " Set internal CPU monitoring for the audio thread.\n @param count Number of samples (tic/toc pairs) in a acquisition cycle. Use 0 to disable.\n @return 0 on success, an error code otherwise."]
742 pub fn Bela_cpuMonitoringInit(count: ::core::ffi::c_int) -> ::core::ffi::c_int;
743}
744unsafe extern "C" {
745 #[doc = " Get stats about internal CPU monitoring.\n\n @return a pointer to a BelaCpuData structure which contains data about the\n CPU usage of the audio thread."]
746 pub fn Bela_cpuMonitoringGet() -> *mut BelaCpuData;
747}
748unsafe extern "C" {
749 #[doc = " Start measuring CPU time. When `data->currentCount` reaches `data->count`, a\n acquisition cycle is completed. `data->percentage` gives the average CPU busy time\n during the latest completed acquisition cycle.\n\n @param data The `count` field is an input and needs to be populated before calling. Other fields are used as I/O by the function."]
750 pub fn Bela_cpuTic(data: *mut BelaCpuData);
751}
752unsafe extern "C" {
753 #[doc = " Stop measuring CPU time.\n\n @param data The `count` field is an input and needs to be populated before calling. Other fields are used as I/O by the function."]
754 pub fn Bela_cpuToc(data: *mut BelaCpuData);
755}
756unsafe extern "C" {
757 #[doc = " \\brief Set the level of the audio line out.\n\n \\b Important: do not call this function from within render(), as it does not make\n any guarantees on real-time performance.\n\n \\param channel The channel to set. Use a negative value to set all channels.\n \\param decibels Level of the line output. Valid values will depend on the codec in use.\n\n \\return 0 on success, or nonzero if an error occurred."]
758 pub fn Bela_setLineOutLevel(channel: ::core::ffi::c_int, decibel: f32) -> ::core::ffi::c_int;
759}
760unsafe extern "C" {
761 #[doc = " \\brief Set the level of the audio DAC.\n\n DEPRECATED.\n\n Use `Bela_setLineOutLevel()` instead."]
762 pub fn Bela_setDacLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
763}
764unsafe extern "C" {
765 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setDacLevel(-1, decibels)`."]
766 pub fn Bela_setDACLevel(decibels: f32) -> ::core::ffi::c_int;
767}
768unsafe extern "C" {
769 #[doc = " \\brief Set the level of the audio ADC.\n\n This function sets the level of the audio input. It does not affect the level of the\n (non-audio) analog inputs.\n\n \\b Important: do not call this function from within render(), as it does not make\n any guarantees on real-time performance.\n\n \\param channel The channel to set. Use a negative value to set all channels.\n \\param decibels Level of the ADC input. Valid levels range from -12 (lowest) to\n 0 (highest) in steps of 1.5dB. Levels between increments of 1.5 will be rounded down.\n\n \\return 0 on success, or nonzero if an error occurred."]
770 pub fn Bela_setAdcLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
771}
772unsafe extern "C" {
773 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAdcLevel(-1, decibels)`."]
774 pub fn Bela_setADCLevel(decibels: f32) -> ::core::ffi::c_int;
775}
776unsafe extern "C" {
777 #[doc = " \\brief Set the gain of the audio input preamplifier.\n\n This function sets the level of the Programmable Gain Amplifier(PGA), which\n amplifies the signal before the ADC.\n\n \\b Important: do not call this function from within render(), as it does not make\n any guarantees on real-time performance.\n\n \\param channel The channel to set. Use a negative value to set all channels.\n \\param decibels Level of the PGA Valid levels range from 0 (lowest) to\n 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded.\n channel 1 is right\n\n \\return 0 on success, or nonzero if an error occurred."]
778 pub fn Bela_setAudioInputGain(channel: ::core::ffi::c_int, decibels: f32)
779 -> ::core::ffi::c_int;
780}
781unsafe extern "C" {
782 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAudioInputGain(channel, decibels)`."]
783 pub fn Bela_setPgaGain(decibels: f32, channel: ::core::ffi::c_int) -> ::core::ffi::c_int;
784}
785unsafe extern "C" {
786 #[doc = " \\brief Set the level of the onboard headphone amplifier.\n\n This function sets the level of the headphone output only (3-pin connector on the Bela\n cape or the output jack on the BeagleBone Audio Cape). It does not affect the level of the\n speakers or the line out pads on the cape.\n\n \\b Important: do not call this function from within render(), as it does not make\n any guarantees on real-time performance.\n\n \\param channel The channel to set. Use a negative value to set all channels.\n \\param decibels Level of the headphone output. Valid levels range from -63.5 (lowest) to\n 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.\n\n \\return 0 on success, or nonzero if an error occurred."]
787 pub fn Bela_setHpLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
788}
789unsafe extern "C" {
790 #[doc = " DEPRECATED\n Equivalent to Bela_setHpLevel(-1, decibels);"]
791 pub fn Bela_setHeadphoneLevel(decibels: f32) -> ::core::ffi::c_int;
792}
793unsafe extern "C" {
794 #[doc = " \\brief Mute or unmute the onboard speaker amplifiers.\n\n This function mutes or unmutes the amplifiers on the Bela cape. Whether the speakers begin\n muted or unmuted depends on the BelaInitSettings structure passed to Bela_initAudio().\n\n \\b Important: do not call this function from within render(), as it does not make\n any guarantees on real-time performance.\n\n \\param mute 0 to enable the speakers, nonzero to mute the speakers.\n\n \\return 0 on success, or nonzero if an error occurred."]
795 pub fn Bela_muteSpeakers(mute: ::core::ffi::c_int) -> ::core::ffi::c_int;
796}
797unsafe extern "C" {
798 #[doc = " \\defgroup warppers Wrappers for real-time functionalities.\n\n @{"]
799 pub fn Bela_initRtBackend();
800}
801unsafe extern "C" {
802 pub fn Bela_gettime(tp: *mut timespec) -> ::core::ffi::c_int;
803}
804unsafe extern "C" {
805 pub fn Bela_clock_gettime(clockid: clockid_t, tp: *mut timespec) -> ::core::ffi::c_int;
806}
807unsafe extern "C" {
808 pub fn Bela_nanosleep(req: *const timespec, rem: *mut timespec) -> ::core::ffi::c_int;
809}
810unsafe extern "C" {
811 pub fn Bela_printFlushBuffers();
812}
813unsafe extern "C" {
814 #[doc = " \\brief Create a new auxiliary task.\n\n This function creates a new auxiliary task which, when scheduled, runs the function specified\n in the first argument. Note that the task does not run until scheduleAuxiliaryTask() is called.\n Auxiliary tasks should be created in `setup()` and never in `render()` itself.\n\n The second argument specifies the real-time priority. Valid values are between 0\n and 99, and usually should be lower than \\ref BELA_AUDIO_PRIORITY. Tasks with higher priority always\n preempt tasks with lower priority.\n\n \\param callback Function which will be called each time the auxiliary task is scheduled, unless it is already running.\n \\param priority Xenomai priority level at which the task should run.\n \\param name Name for this task, which should be unique system-wide (no other running program should use this name).\n \\param arg The argument passed to the callback function."]
815 pub fn Bela_createAuxiliaryTask(
816 callback: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
817 priority: ::core::ffi::c_int,
818 name: *const ::core::ffi::c_char,
819 arg: *mut ::core::ffi::c_void,
820 ) -> AuxiliaryTask;
821}
822unsafe extern "C" {
823 #[doc = " \\brief Run an auxiliary task which has previously been created.\n\n This function will schedule an auxiliary task to run.\n\n If the task is already running, calling this function has no effect.\n If the task is not running (e.g.: a previous invocation has returned), the \\b callback function defined\n in Bela_createAuxiliaryTask() will be called and it will be passed the \\b arg pointer as its only parameter.\n\n This function is typically called from render() to start a lower-priority task. The function\n will not run immediately, but only once any active higher priority tasks have finished.\n\n \\param task Task to schedule for running.\n \\return 0 if the task was successfully scheduled, a positive error number otherwise. The most frequent error will be EBUSY, if the task was still running as a consequence of a previous call."]
824 pub fn Bela_scheduleAuxiliaryTask(task: AuxiliaryTask) -> ::core::ffi::c_int;
825}
826unsafe extern "C" {
827 pub fn Bela_deleteAllAuxiliaryTasks();
828}
829pub const BelaDigitalDirection_INPUT: BelaDigitalDirection = 0;
830pub const BelaDigitalDirection_OUTPUT: BelaDigitalDirection = 1;
831#[doc = " \\defgroup iofunctions I/O functions and constants\n\n These functions and macros are used for audio, analog and digital I/O. All the\n I/O functions require the BelaContext data structure from render() to be passed\n in. This means that these functions are, by design, \\b only usable from within\n the rendering thread.\n\n The naming conventions are loosely derived from the Arduino environment, and the\n syntax is similar. Unlike Arduino, the I/O functions require the frame number at which\n the read or write should take place, since all I/O happens synchronously with the\n audio clock.\n\n @{"]
832pub type BelaDigitalDirection = ::core::ffi::c_uint;