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 = 14;
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 __syscall_slong_t = ::core::ffi::c_long;
31pub type __gnuc_va_list = __BindgenOpaqueArray<u64, 4usize>;
32pub type FILE = _IO_FILE;
33#[repr(C)]
34#[derive(Debug, Copy, Clone)]
35pub struct _IO_marker {
36 _unused: [u8; 0],
37}
38#[repr(C)]
39#[derive(Debug, Copy, Clone)]
40pub struct _IO_codecvt {
41 _unused: [u8; 0],
42}
43#[repr(C)]
44#[derive(Debug, Copy, Clone)]
45pub struct _IO_wide_data {
46 _unused: [u8; 0],
47}
48pub type _IO_lock_t = ::core::ffi::c_void;
49#[repr(C)]
50#[derive(Debug, Copy, Clone)]
51pub struct _IO_FILE {
52 pub _flags: ::core::ffi::c_int,
53 pub _IO_read_ptr: *mut ::core::ffi::c_char,
54 pub _IO_read_end: *mut ::core::ffi::c_char,
55 pub _IO_read_base: *mut ::core::ffi::c_char,
56 pub _IO_write_base: *mut ::core::ffi::c_char,
57 pub _IO_write_ptr: *mut ::core::ffi::c_char,
58 pub _IO_write_end: *mut ::core::ffi::c_char,
59 pub _IO_buf_base: *mut ::core::ffi::c_char,
60 pub _IO_buf_end: *mut ::core::ffi::c_char,
61 pub _IO_save_base: *mut ::core::ffi::c_char,
62 pub _IO_backup_base: *mut ::core::ffi::c_char,
63 pub _IO_save_end: *mut ::core::ffi::c_char,
64 pub _markers: *mut _IO_marker,
65 pub _chain: *mut _IO_FILE,
66 pub _fileno: ::core::ffi::c_int,
67 pub _flags2: ::core::ffi::c_int,
68 pub _old_offset: __off_t,
69 pub _cur_column: ::core::ffi::c_ushort,
70 pub _vtable_offset: ::core::ffi::c_schar,
71 pub _shortbuf: [::core::ffi::c_char; 1usize],
72 pub _lock: *mut _IO_lock_t,
73 pub _offset: __off64_t,
74 pub _codecvt: *mut _IO_codecvt,
75 pub _wide_data: *mut _IO_wide_data,
76 pub _freeres_list: *mut _IO_FILE,
77 pub _freeres_buf: *mut ::core::ffi::c_void,
78 pub __pad5: usize,
79 pub _mode: ::core::ffi::c_int,
80 pub _unused2: [::core::ffi::c_char; 20usize],
81}
82#[allow(clippy::unnecessary_operation, clippy::identity_op)]
83const _: () = {
84 ["Size of _IO_FILE"][::core::mem::size_of::<_IO_FILE>() - 216usize];
85 ["Alignment of _IO_FILE"][::core::mem::align_of::<_IO_FILE>() - 8usize];
86 ["Offset of field: _IO_FILE::_flags"][::core::mem::offset_of!(_IO_FILE, _flags) - 0usize];
87 ["Offset of field: _IO_FILE::_IO_read_ptr"]
88 [::core::mem::offset_of!(_IO_FILE, _IO_read_ptr) - 8usize];
89 ["Offset of field: _IO_FILE::_IO_read_end"]
90 [::core::mem::offset_of!(_IO_FILE, _IO_read_end) - 16usize];
91 ["Offset of field: _IO_FILE::_IO_read_base"]
92 [::core::mem::offset_of!(_IO_FILE, _IO_read_base) - 24usize];
93 ["Offset of field: _IO_FILE::_IO_write_base"]
94 [::core::mem::offset_of!(_IO_FILE, _IO_write_base) - 32usize];
95 ["Offset of field: _IO_FILE::_IO_write_ptr"]
96 [::core::mem::offset_of!(_IO_FILE, _IO_write_ptr) - 40usize];
97 ["Offset of field: _IO_FILE::_IO_write_end"]
98 [::core::mem::offset_of!(_IO_FILE, _IO_write_end) - 48usize];
99 ["Offset of field: _IO_FILE::_IO_buf_base"]
100 [::core::mem::offset_of!(_IO_FILE, _IO_buf_base) - 56usize];
101 ["Offset of field: _IO_FILE::_IO_buf_end"]
102 [::core::mem::offset_of!(_IO_FILE, _IO_buf_end) - 64usize];
103 ["Offset of field: _IO_FILE::_IO_save_base"]
104 [::core::mem::offset_of!(_IO_FILE, _IO_save_base) - 72usize];
105 ["Offset of field: _IO_FILE::_IO_backup_base"]
106 [::core::mem::offset_of!(_IO_FILE, _IO_backup_base) - 80usize];
107 ["Offset of field: _IO_FILE::_IO_save_end"]
108 [::core::mem::offset_of!(_IO_FILE, _IO_save_end) - 88usize];
109 ["Offset of field: _IO_FILE::_markers"][::core::mem::offset_of!(_IO_FILE, _markers) - 96usize];
110 ["Offset of field: _IO_FILE::_chain"][::core::mem::offset_of!(_IO_FILE, _chain) - 104usize];
111 ["Offset of field: _IO_FILE::_fileno"][::core::mem::offset_of!(_IO_FILE, _fileno) - 112usize];
112 ["Offset of field: _IO_FILE::_flags2"][::core::mem::offset_of!(_IO_FILE, _flags2) - 116usize];
113 ["Offset of field: _IO_FILE::_old_offset"]
114 [::core::mem::offset_of!(_IO_FILE, _old_offset) - 120usize];
115 ["Offset of field: _IO_FILE::_cur_column"]
116 [::core::mem::offset_of!(_IO_FILE, _cur_column) - 128usize];
117 ["Offset of field: _IO_FILE::_vtable_offset"]
118 [::core::mem::offset_of!(_IO_FILE, _vtable_offset) - 130usize];
119 ["Offset of field: _IO_FILE::_shortbuf"]
120 [::core::mem::offset_of!(_IO_FILE, _shortbuf) - 131usize];
121 ["Offset of field: _IO_FILE::_lock"][::core::mem::offset_of!(_IO_FILE, _lock) - 136usize];
122 ["Offset of field: _IO_FILE::_offset"][::core::mem::offset_of!(_IO_FILE, _offset) - 144usize];
123 ["Offset of field: _IO_FILE::_codecvt"][::core::mem::offset_of!(_IO_FILE, _codecvt) - 152usize];
124 ["Offset of field: _IO_FILE::_wide_data"]
125 [::core::mem::offset_of!(_IO_FILE, _wide_data) - 160usize];
126 ["Offset of field: _IO_FILE::_freeres_list"]
127 [::core::mem::offset_of!(_IO_FILE, _freeres_list) - 168usize];
128 ["Offset of field: _IO_FILE::_freeres_buf"]
129 [::core::mem::offset_of!(_IO_FILE, _freeres_buf) - 176usize];
130 ["Offset of field: _IO_FILE::__pad5"][::core::mem::offset_of!(_IO_FILE, __pad5) - 184usize];
131 ["Offset of field: _IO_FILE::_mode"][::core::mem::offset_of!(_IO_FILE, _mode) - 192usize];
132 ["Offset of field: _IO_FILE::_unused2"][::core::mem::offset_of!(_IO_FILE, _unused2) - 196usize];
133};
134impl Default for _IO_FILE {
135 fn default() -> Self {
136 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
137 unsafe {
138 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
139 s.assume_init()
140 }
141 }
142}
143pub type va_list = __gnuc_va_list;
144unsafe extern "C" {
145 pub fn rt_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
146}
147unsafe extern "C" {
148 pub fn Bela_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
149}
150#[doc = "< No hardware"]
151pub const BelaHw_BelaHw_NoHw: BelaHw = -1;
152#[doc = "< Bela"]
153pub const BelaHw_BelaHw_Bela: BelaHw = 0;
154#[doc = "< Bela Mini"]
155pub const BelaHw_BelaHw_BelaMini: BelaHw = 1;
156#[doc = "< Salt"]
157pub const BelaHw_BelaHw_Salt: BelaHw = 2;
158#[doc = "< Ctag Face"]
159pub const BelaHw_BelaHw_CtagFace: BelaHw = 3;
160#[doc = "< Ctag Beast"]
161pub const BelaHw_BelaHw_CtagBeast: BelaHw = 4;
162#[doc = "< Ctag Face and Bela cape"]
163pub const BelaHw_BelaHw_CtagFaceBela: BelaHw = 5;
164#[doc = "< Ctag Beast and Bela cape"]
165pub const BelaHw_BelaHw_CtagBeastBela: BelaHw = 6;
166#[doc = "< Bela Mini with extra codecs"]
167pub const BelaHw_BelaHw_BelaMiniMultiAudio: BelaHw = 7;
168#[doc = "< Bela Mini with extra codecs and/or tdm devices"]
169pub const BelaHw_BelaHw_BelaMiniMultiTdm: BelaHw = 8;
170#[doc = "< Bela with extra codecs and/or tdm devices"]
171pub const BelaHw_BelaHw_BelaMultiTdm: BelaHw = 9;
172#[doc = "< Bela Mini with extra rx and tx I2S data lines."]
173pub const BelaHw_BelaHw_BelaMiniMultiI2s: BelaHw = 10;
174#[doc = "< A Bela cape with Es9080 EVB on top, all as audio"]
175pub const BelaHw_BelaHw_BelaEs9080: BelaHw = 11;
176#[doc = "< A Bela cape rev C: Es9080 is used for analog outs"]
177pub const BelaHw_BelaHw_BelaRevC: BelaHw = 12;
178#[doc = "< Dummy offline"]
179pub const BelaHw_BelaHw_Batch: BelaHw = 13;
180#[doc = " A type of Bela hardware."]
181pub type BelaHw = ::core::ffi::c_int;
182#[repr(C)]
183#[derive(Debug, Default, Copy, Clone)]
184pub struct _BelaHwConfig {
185 pub audioSampleRate: f32,
186 pub audioInChannels: ::core::ffi::c_uint,
187 pub audioOutChannels: ::core::ffi::c_uint,
188 pub analogInChannels: ::core::ffi::c_uint,
189 pub analogOutChannels: ::core::ffi::c_uint,
190 pub digitalChannels: ::core::ffi::c_uint,
191}
192#[allow(clippy::unnecessary_operation, clippy::identity_op)]
193const _: () = {
194 ["Size of _BelaHwConfig"][::core::mem::size_of::<_BelaHwConfig>() - 24usize];
195 ["Alignment of _BelaHwConfig"][::core::mem::align_of::<_BelaHwConfig>() - 4usize];
196 ["Offset of field: _BelaHwConfig::audioSampleRate"]
197 [::core::mem::offset_of!(_BelaHwConfig, audioSampleRate) - 0usize];
198 ["Offset of field: _BelaHwConfig::audioInChannels"]
199 [::core::mem::offset_of!(_BelaHwConfig, audioInChannels) - 4usize];
200 ["Offset of field: _BelaHwConfig::audioOutChannels"]
201 [::core::mem::offset_of!(_BelaHwConfig, audioOutChannels) - 8usize];
202 ["Offset of field: _BelaHwConfig::analogInChannels"]
203 [::core::mem::offset_of!(_BelaHwConfig, analogInChannels) - 12usize];
204 ["Offset of field: _BelaHwConfig::analogOutChannels"]
205 [::core::mem::offset_of!(_BelaHwConfig, analogOutChannels) - 16usize];
206 ["Offset of field: _BelaHwConfig::digitalChannels"]
207 [::core::mem::offset_of!(_BelaHwConfig, digitalChannels) - 20usize];
208};
209pub type BelaHwConfig = _BelaHwConfig;
210unsafe extern "C" {
211 #[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()."]
212 pub fn Bela_HwConfig_new(hw: BelaHw) -> *mut BelaHwConfig;
213}
214unsafe extern "C" {
215 #[doc = " Use this to delete a pointer returned by Bela_HwConfig_new()"]
216 pub fn Bela_HwConfig_delete(cfg: *mut BelaHwConfig);
217}
218#[doc = "< perform an automatic detection by scanning the peripherals and busses available, and cache value in `/run/bela/belaconfig`"]
219pub const BelaHwDetectMode_BelaHwDetectMode_Scan: BelaHwDetectMode = 0;
220#[doc = "< read cached value from `/run/bela/belaconfig` first. If it does not exist, fall back to #BelaHwDetectMode_Scan"]
221pub const BelaHwDetectMode_BelaHwDetectMode_Cache: BelaHwDetectMode = 1;
222#[doc = "<read cached value from `/run/bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
223pub const BelaHwDetectMode_BelaHwDetectMode_CacheOnly: BelaHwDetectMode = 2;
224#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, fall back to #BelaHwDetectMode_Cache"]
225pub const BelaHwDetectMode_BelaHwDetectMode_User: BelaHwDetectMode = 3;
226#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
227pub const BelaHwDetectMode_BelaHwDetectMode_UserOnly: BelaHwDetectMode = 4;
228#[doc = " Arguments to be passed to Bela_detectHw()"]
229pub type BelaHwDetectMode = ::core::ffi::c_uint;
230#[repr(C)]
231#[derive(Debug, Copy, Clone)]
232pub struct option {
233 _unused: [u8; 0],
234}
235#[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."]
236#[repr(C)]
237#[derive(Debug, Copy, Clone)]
238pub struct BelaContext {
239 #[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."]
240 pub audioIn: *const f32,
241 #[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."]
242 pub audioOut: *mut f32,
243 #[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."]
244 pub analogIn: *const f32,
245 #[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."]
246 pub analogOut: *mut f32,
247 #[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."]
248 pub digital: *mut u32,
249 #[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."]
250 pub audioFrames: u32,
251 #[doc = " \\brief The number of audio input channels"]
252 pub audioInChannels: u32,
253 #[doc = " \\brief The number of audio output channels"]
254 pub audioOutChannels: u32,
255 #[doc = " \\brief The audio sample rate in Hz (currently always 44100.0)"]
256 pub audioSampleRate: f32,
257 #[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."]
258 pub analogFrames: u32,
259 #[doc = " \\brief The number of analog input channels\n\n This will be 0 if analog I/O is disabled."]
260 pub analogInChannels: u32,
261 #[doc = " \\brief The number of analog output channels\n\n This will be 0 if analog I/O is disabled."]
262 pub analogOutChannels: u32,
263 #[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."]
264 pub analogSampleRate: f32,
265 #[doc = " Number of digital frames per period"]
266 pub digitalFrames: u32,
267 #[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."]
268 pub digitalChannels: u32,
269 #[doc = " Digital sample rate in Hz (currently always 44100.0)"]
270 pub digitalSampleRate: f32,
271 #[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)."]
272 pub audioFramesElapsed: u64,
273 #[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."]
274 pub multiplexerChannels: u32,
275 #[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."]
276 pub multiplexerStartingChannel: u32,
277 #[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."]
278 pub multiplexerAnalogIn: *const f32,
279 #[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."]
280 pub audioExpanderEnabled: u32,
281 #[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"]
282 pub flags: u32,
283 #[doc = " Name of running project."]
284 pub projectName: [::core::ffi::c_char; 256usize],
285 #[doc = " Number of detected underruns."]
286 pub underrunCount: ::core::ffi::c_uint,
287}
288#[allow(clippy::unnecessary_operation, clippy::identity_op)]
289const _: () = {
290 ["Size of BelaContext"][::core::mem::size_of::<BelaContext>() - 384usize];
291 ["Alignment of BelaContext"][::core::mem::align_of::<BelaContext>() - 8usize];
292 ["Offset of field: BelaContext::audioIn"]
293 [::core::mem::offset_of!(BelaContext, audioIn) - 0usize];
294 ["Offset of field: BelaContext::audioOut"]
295 [::core::mem::offset_of!(BelaContext, audioOut) - 8usize];
296 ["Offset of field: BelaContext::analogIn"]
297 [::core::mem::offset_of!(BelaContext, analogIn) - 16usize];
298 ["Offset of field: BelaContext::analogOut"]
299 [::core::mem::offset_of!(BelaContext, analogOut) - 24usize];
300 ["Offset of field: BelaContext::digital"]
301 [::core::mem::offset_of!(BelaContext, digital) - 32usize];
302 ["Offset of field: BelaContext::audioFrames"]
303 [::core::mem::offset_of!(BelaContext, audioFrames) - 40usize];
304 ["Offset of field: BelaContext::audioInChannels"]
305 [::core::mem::offset_of!(BelaContext, audioInChannels) - 44usize];
306 ["Offset of field: BelaContext::audioOutChannels"]
307 [::core::mem::offset_of!(BelaContext, audioOutChannels) - 48usize];
308 ["Offset of field: BelaContext::audioSampleRate"]
309 [::core::mem::offset_of!(BelaContext, audioSampleRate) - 52usize];
310 ["Offset of field: BelaContext::analogFrames"]
311 [::core::mem::offset_of!(BelaContext, analogFrames) - 56usize];
312 ["Offset of field: BelaContext::analogInChannels"]
313 [::core::mem::offset_of!(BelaContext, analogInChannels) - 60usize];
314 ["Offset of field: BelaContext::analogOutChannels"]
315 [::core::mem::offset_of!(BelaContext, analogOutChannels) - 64usize];
316 ["Offset of field: BelaContext::analogSampleRate"]
317 [::core::mem::offset_of!(BelaContext, analogSampleRate) - 68usize];
318 ["Offset of field: BelaContext::digitalFrames"]
319 [::core::mem::offset_of!(BelaContext, digitalFrames) - 72usize];
320 ["Offset of field: BelaContext::digitalChannels"]
321 [::core::mem::offset_of!(BelaContext, digitalChannels) - 76usize];
322 ["Offset of field: BelaContext::digitalSampleRate"]
323 [::core::mem::offset_of!(BelaContext, digitalSampleRate) - 80usize];
324 ["Offset of field: BelaContext::audioFramesElapsed"]
325 [::core::mem::offset_of!(BelaContext, audioFramesElapsed) - 88usize];
326 ["Offset of field: BelaContext::multiplexerChannels"]
327 [::core::mem::offset_of!(BelaContext, multiplexerChannels) - 96usize];
328 ["Offset of field: BelaContext::multiplexerStartingChannel"]
329 [::core::mem::offset_of!(BelaContext, multiplexerStartingChannel) - 100usize];
330 ["Offset of field: BelaContext::multiplexerAnalogIn"]
331 [::core::mem::offset_of!(BelaContext, multiplexerAnalogIn) - 104usize];
332 ["Offset of field: BelaContext::audioExpanderEnabled"]
333 [::core::mem::offset_of!(BelaContext, audioExpanderEnabled) - 112usize];
334 ["Offset of field: BelaContext::flags"][::core::mem::offset_of!(BelaContext, flags) - 116usize];
335 ["Offset of field: BelaContext::projectName"]
336 [::core::mem::offset_of!(BelaContext, projectName) - 120usize];
337 ["Offset of field: BelaContext::underrunCount"]
338 [::core::mem::offset_of!(BelaContext, underrunCount) - 376usize];
339};
340impl Default for BelaContext {
341 fn default() -> Self {
342 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
343 unsafe {
344 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
345 s.assume_init()
346 }
347 }
348}
349#[repr(C)]
350#[derive(Debug, Default, Copy, Clone)]
351pub struct BelaChannelGain {
352 #[doc = "< Channel number. Negative value means all the channels"]
353 pub channel: ::core::ffi::c_int,
354 #[doc = "< Gain in dB."]
355 pub gain: f32,
356}
357#[allow(clippy::unnecessary_operation, clippy::identity_op)]
358const _: () = {
359 ["Size of BelaChannelGain"][::core::mem::size_of::<BelaChannelGain>() - 8usize];
360 ["Alignment of BelaChannelGain"][::core::mem::align_of::<BelaChannelGain>() - 4usize];
361 ["Offset of field: BelaChannelGain::channel"]
362 [::core::mem::offset_of!(BelaChannelGain, channel) - 0usize];
363 ["Offset of field: BelaChannelGain::gain"]
364 [::core::mem::offset_of!(BelaChannelGain, gain) - 4usize];
365};
366#[repr(C)]
367#[derive(Debug, Copy, Clone)]
368pub struct BelaChannelGainArray {
369 pub length: ::core::ffi::c_uint,
370 pub data: *mut BelaChannelGain,
371}
372#[allow(clippy::unnecessary_operation, clippy::identity_op)]
373const _: () = {
374 ["Size of BelaChannelGainArray"][::core::mem::size_of::<BelaChannelGainArray>() - 16usize];
375 ["Alignment of BelaChannelGainArray"][::core::mem::align_of::<BelaChannelGainArray>() - 8usize];
376 ["Offset of field: BelaChannelGainArray::length"]
377 [::core::mem::offset_of!(BelaChannelGainArray, length) - 0usize];
378 ["Offset of field: BelaChannelGainArray::data"]
379 [::core::mem::offset_of!(BelaChannelGainArray, data) - 8usize];
380};
381impl Default for BelaChannelGainArray {
382 fn default() -> Self {
383 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
384 unsafe {
385 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
386 s.assume_init()
387 }
388 }
389}
390#[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."]
391#[repr(C)]
392#[derive(Debug, Copy, Clone)]
393pub struct BelaInitSettings {
394 #[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."]
395 pub periodSize: ::core::ffi::c_int,
396 #[doc = " Whether to use the analog input and output"]
397 pub useAnalog: ::core::ffi::c_int,
398 #[doc = " Whether to use the 16 programmable GPIOs"]
399 pub useDigital: ::core::ffi::c_int,
400 #[doc = " How many audio input channels [ignored]"]
401 pub numAudioInChannels: ::core::ffi::c_int,
402 #[doc = " How many audio out channels [ignored]"]
403 pub numAudioOutChannels: ::core::ffi::c_int,
404 #[doc = " How many analog input channels"]
405 pub numAnalogInChannels: ::core::ffi::c_int,
406 #[doc = " How many analog output channels"]
407 pub numAnalogOutChannels: ::core::ffi::c_int,
408 #[doc = " How many channels for the GPIOs"]
409 pub numDigitalChannels: ::core::ffi::c_int,
410 #[doc = " Whether to begin with the speakers muted"]
411 pub beginMuted: ::core::ffi::c_int,
412 #[doc = " Level for the audio DAC output. DEPRECATED: ues lineOutGains"]
413 pub dacLevel: f32,
414 #[doc = " Level for the audio ADC input. DEPRECATED: use audioInputGains"]
415 pub adcLevel: f32,
416 #[doc = " Gains for the PGA, left and right channels. DEPRECATED: use audioInputGains"]
417 pub pgaGain: [f32; 2usize],
418 #[doc = " Level for the headphone output. DEPRECATED: use headphoneGains"]
419 pub headphoneLevel: f32,
420 #[doc = " How many channels to use on the multiplexer capelet, if enabled"]
421 pub numMuxChannels: ::core::ffi::c_int,
422 #[doc = " Which audio expander settings to use on the input"]
423 pub audioExpanderInputs: ::core::ffi::c_uint,
424 #[doc = " Which audio expander settings to use on the input"]
425 pub audioExpanderOutputs: ::core::ffi::c_uint,
426 #[doc = " Which PRU (0 or 1) the code should run on"]
427 pub pruNumber: ::core::ffi::c_int,
428 #[doc = " The external .bin file to load. If empty will use PRU code from pru_rtaudio_bin.h"]
429 pub pruFilename: [::core::ffi::c_char; 256usize],
430 #[doc = " Whether to detect and log underruns"]
431 pub detectUnderruns: ::core::ffi::c_int,
432 #[doc = " Whether to use verbose logging"]
433 pub verbose: ::core::ffi::c_int,
434 #[doc = " Whether to use the blinking LED to indicate Bela is running"]
435 pub enableLED: ::core::ffi::c_int,
436 #[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."]
437 pub stopButtonPin: ::core::ffi::c_int,
438 #[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"]
439 pub highPerformanceMode: ::core::ffi::c_int,
440 #[doc = " Whether audio/analog data should be interleaved"]
441 pub interleave: ::core::ffi::c_int,
442 #[doc = " \\brief Whether analog outputs should persist to future frames.\n\n n.b. digital pins always persist, audio never does"]
443 pub analogOutputsPersist: ::core::ffi::c_int,
444 #[doc = " \\brief Whether the analog channels should be resampled to\n audio sampling rate."]
445 pub uniformSampleRate: ::core::ffi::c_int,
446 #[doc = " \\brief The requested stack size for the audio thread. Defaults"]
447 pub audioThreadStackSize: ::core::ffi::c_uint,
448 #[doc = " \\brief The requested stack size for each AuxilaryTask. Defaults"]
449 pub auxiliaryTaskStackSize: ::core::ffi::c_uint,
450 pub setup: ::core::option::Option<
451 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void) -> bool,
452 >,
453 pub render: ::core::option::Option<
454 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
455 >,
456 pub cleanup: ::core::option::Option<
457 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
458 >,
459 #[doc = " Pin where amplifier mute can be found"]
460 pub ampMutePin: ::core::ffi::c_int,
461 #[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."]
462 pub audioThreadDone: ::core::option::Option<
463 unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
464 >,
465 #[doc = " A codec-specific intialisation parameter"]
466 pub codecMode: *mut ::core::ffi::c_char,
467 #[doc = " audio input gains"]
468 pub audioInputGains: BelaChannelGainArray,
469 #[doc = " level for headphone outputs"]
470 pub headphoneGains: BelaChannelGainArray,
471 #[doc = " Level for the audio ADC input DEPRECATED: use audioInputGains"]
472 pub adcGains: BelaChannelGainArray,
473 #[doc = " Level for the audio line level output"]
474 pub lineOutGains: BelaChannelGainArray,
475 #[doc = " A bitmask of disabled digital channels"]
476 pub disabledDigitalChannels: u32,
477 pub unused: [::core::ffi::c_char; 220usize],
478 #[doc = " User selected board to work with (as opposed to detected hardware)."]
479 pub board: BelaHw,
480 #[doc = " Name of running project."]
481 pub projectName: *mut ::core::ffi::c_char,
482}
483#[allow(clippy::unnecessary_operation, clippy::identity_op)]
484const _: () = {
485 ["Size of BelaInitSettings"][::core::mem::size_of::<BelaInitSettings>() - 720usize];
486 ["Alignment of BelaInitSettings"][::core::mem::align_of::<BelaInitSettings>() - 8usize];
487 ["Offset of field: BelaInitSettings::periodSize"]
488 [::core::mem::offset_of!(BelaInitSettings, periodSize) - 0usize];
489 ["Offset of field: BelaInitSettings::useAnalog"]
490 [::core::mem::offset_of!(BelaInitSettings, useAnalog) - 4usize];
491 ["Offset of field: BelaInitSettings::useDigital"]
492 [::core::mem::offset_of!(BelaInitSettings, useDigital) - 8usize];
493 ["Offset of field: BelaInitSettings::numAudioInChannels"]
494 [::core::mem::offset_of!(BelaInitSettings, numAudioInChannels) - 12usize];
495 ["Offset of field: BelaInitSettings::numAudioOutChannels"]
496 [::core::mem::offset_of!(BelaInitSettings, numAudioOutChannels) - 16usize];
497 ["Offset of field: BelaInitSettings::numAnalogInChannels"]
498 [::core::mem::offset_of!(BelaInitSettings, numAnalogInChannels) - 20usize];
499 ["Offset of field: BelaInitSettings::numAnalogOutChannels"]
500 [::core::mem::offset_of!(BelaInitSettings, numAnalogOutChannels) - 24usize];
501 ["Offset of field: BelaInitSettings::numDigitalChannels"]
502 [::core::mem::offset_of!(BelaInitSettings, numDigitalChannels) - 28usize];
503 ["Offset of field: BelaInitSettings::beginMuted"]
504 [::core::mem::offset_of!(BelaInitSettings, beginMuted) - 32usize];
505 ["Offset of field: BelaInitSettings::dacLevel"]
506 [::core::mem::offset_of!(BelaInitSettings, dacLevel) - 36usize];
507 ["Offset of field: BelaInitSettings::adcLevel"]
508 [::core::mem::offset_of!(BelaInitSettings, adcLevel) - 40usize];
509 ["Offset of field: BelaInitSettings::pgaGain"]
510 [::core::mem::offset_of!(BelaInitSettings, pgaGain) - 44usize];
511 ["Offset of field: BelaInitSettings::headphoneLevel"]
512 [::core::mem::offset_of!(BelaInitSettings, headphoneLevel) - 52usize];
513 ["Offset of field: BelaInitSettings::numMuxChannels"]
514 [::core::mem::offset_of!(BelaInitSettings, numMuxChannels) - 56usize];
515 ["Offset of field: BelaInitSettings::audioExpanderInputs"]
516 [::core::mem::offset_of!(BelaInitSettings, audioExpanderInputs) - 60usize];
517 ["Offset of field: BelaInitSettings::audioExpanderOutputs"]
518 [::core::mem::offset_of!(BelaInitSettings, audioExpanderOutputs) - 64usize];
519 ["Offset of field: BelaInitSettings::pruNumber"]
520 [::core::mem::offset_of!(BelaInitSettings, pruNumber) - 68usize];
521 ["Offset of field: BelaInitSettings::pruFilename"]
522 [::core::mem::offset_of!(BelaInitSettings, pruFilename) - 72usize];
523 ["Offset of field: BelaInitSettings::detectUnderruns"]
524 [::core::mem::offset_of!(BelaInitSettings, detectUnderruns) - 328usize];
525 ["Offset of field: BelaInitSettings::verbose"]
526 [::core::mem::offset_of!(BelaInitSettings, verbose) - 332usize];
527 ["Offset of field: BelaInitSettings::enableLED"]
528 [::core::mem::offset_of!(BelaInitSettings, enableLED) - 336usize];
529 ["Offset of field: BelaInitSettings::stopButtonPin"]
530 [::core::mem::offset_of!(BelaInitSettings, stopButtonPin) - 340usize];
531 ["Offset of field: BelaInitSettings::highPerformanceMode"]
532 [::core::mem::offset_of!(BelaInitSettings, highPerformanceMode) - 344usize];
533 ["Offset of field: BelaInitSettings::interleave"]
534 [::core::mem::offset_of!(BelaInitSettings, interleave) - 348usize];
535 ["Offset of field: BelaInitSettings::analogOutputsPersist"]
536 [::core::mem::offset_of!(BelaInitSettings, analogOutputsPersist) - 352usize];
537 ["Offset of field: BelaInitSettings::uniformSampleRate"]
538 [::core::mem::offset_of!(BelaInitSettings, uniformSampleRate) - 356usize];
539 ["Offset of field: BelaInitSettings::audioThreadStackSize"]
540 [::core::mem::offset_of!(BelaInitSettings, audioThreadStackSize) - 360usize];
541 ["Offset of field: BelaInitSettings::auxiliaryTaskStackSize"]
542 [::core::mem::offset_of!(BelaInitSettings, auxiliaryTaskStackSize) - 364usize];
543 ["Offset of field: BelaInitSettings::setup"]
544 [::core::mem::offset_of!(BelaInitSettings, setup) - 368usize];
545 ["Offset of field: BelaInitSettings::render"]
546 [::core::mem::offset_of!(BelaInitSettings, render) - 376usize];
547 ["Offset of field: BelaInitSettings::cleanup"]
548 [::core::mem::offset_of!(BelaInitSettings, cleanup) - 384usize];
549 ["Offset of field: BelaInitSettings::ampMutePin"]
550 [::core::mem::offset_of!(BelaInitSettings, ampMutePin) - 392usize];
551 ["Offset of field: BelaInitSettings::audioThreadDone"]
552 [::core::mem::offset_of!(BelaInitSettings, audioThreadDone) - 400usize];
553 ["Offset of field: BelaInitSettings::codecMode"]
554 [::core::mem::offset_of!(BelaInitSettings, codecMode) - 408usize];
555 ["Offset of field: BelaInitSettings::audioInputGains"]
556 [::core::mem::offset_of!(BelaInitSettings, audioInputGains) - 416usize];
557 ["Offset of field: BelaInitSettings::headphoneGains"]
558 [::core::mem::offset_of!(BelaInitSettings, headphoneGains) - 432usize];
559 ["Offset of field: BelaInitSettings::adcGains"]
560 [::core::mem::offset_of!(BelaInitSettings, adcGains) - 448usize];
561 ["Offset of field: BelaInitSettings::lineOutGains"]
562 [::core::mem::offset_of!(BelaInitSettings, lineOutGains) - 464usize];
563 ["Offset of field: BelaInitSettings::disabledDigitalChannels"]
564 [::core::mem::offset_of!(BelaInitSettings, disabledDigitalChannels) - 480usize];
565 ["Offset of field: BelaInitSettings::unused"]
566 [::core::mem::offset_of!(BelaInitSettings, unused) - 484usize];
567 ["Offset of field: BelaInitSettings::board"]
568 [::core::mem::offset_of!(BelaInitSettings, board) - 704usize];
569 ["Offset of field: BelaInitSettings::projectName"]
570 [::core::mem::offset_of!(BelaInitSettings, projectName) - 712usize];
571};
572impl Default for BelaInitSettings {
573 fn default() -> Self {
574 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
575 unsafe {
576 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
577 s.assume_init()
578 }
579 }
580}
581#[doc = " \\ingroup auxtask\n\n Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and\n automatically cleaned up after cleanup() finishes."]
582pub type AuxiliaryTask = *mut ::core::ffi::c_void;
583unsafe extern "C" {
584 #[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."]
585 pub fn Bela_InitSettings_alloc() -> *mut BelaInitSettings;
586}
587unsafe extern "C" {
588 #[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."]
589 pub fn Bela_InitSettings_free(settings: *mut BelaInitSettings);
590}
591unsafe extern "C" {
592 #[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."]
593 pub fn Bela_defaultSettings(settings: *mut BelaInitSettings);
594}
595unsafe extern "C" {
596 #[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."]
597 pub fn Bela_userSettings(settings: *mut BelaInitSettings);
598}
599unsafe extern "C" {
600 #[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."]
601 pub fn Bela_getopt_long(
602 argc: ::core::ffi::c_int,
603 argv: *const *mut ::core::ffi::c_char,
604 customShortOptions: *const ::core::ffi::c_char,
605 customLongOptions: *const option,
606 settings: *mut BelaInitSettings,
607 ) -> ::core::ffi::c_int;
608}
609unsafe extern "C" {
610 #[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."]
611 pub fn Bela_usage();
612}
613unsafe extern "C" {
614 #[doc = " \\brief Get the version of Bela you are running."]
615 pub fn Bela_getVersion(
616 major: *mut ::core::ffi::c_int,
617 minor: *mut ::core::ffi::c_int,
618 bugfix: *mut ::core::ffi::c_int,
619 );
620}
621unsafe extern "C" {
622 #[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."]
623 pub fn Bela_setVerboseLevel(level: ::core::ffi::c_int);
624}
625unsafe extern "C" {
626 #[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."]
627 pub fn Bela_detectHw(mode: BelaHwDetectMode) -> BelaHw;
628}
629unsafe extern "C" {
630 #[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."]
631 pub fn Bela_initAudio(
632 settings: *mut BelaInitSettings,
633 userData: *mut ::core::ffi::c_void,
634 ) -> ::core::ffi::c_int;
635}
636unsafe extern "C" {
637 #[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."]
638 pub fn Bela_startAudio() -> ::core::ffi::c_int;
639}
640unsafe extern "C" {
641 #[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."]
642 pub fn Bela_runInSameThread() -> ::core::ffi::c_int;
643}
644unsafe extern "C" {
645 #[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."]
646 pub fn Bela_stopAudio();
647}
648unsafe extern "C" {
649 #[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."]
650 pub fn Bela_cleanupAudio();
651}
652unsafe extern "C" {
653 #[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."]
654 pub fn Bela_setUserData(newUserData: *mut ::core::ffi::c_void);
655}
656unsafe extern "C" {
657 #[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."]
658 pub fn Bela_requestStop();
659}
660unsafe extern "C" {
661 #[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."]
662 pub fn Bela_stopRequested() -> ::core::ffi::c_int;
663}
664#[repr(C)]
665#[derive(Debug, Default, Copy, Clone)]
666pub struct timespec {
667 pub tv_sec: __time_t,
668 pub tv_nsec: __syscall_slong_t,
669}
670#[allow(clippy::unnecessary_operation, clippy::identity_op)]
671const _: () = {
672 ["Size of timespec"][::core::mem::size_of::<timespec>() - 16usize];
673 ["Alignment of timespec"][::core::mem::align_of::<timespec>() - 8usize];
674 ["Offset of field: timespec::tv_sec"][::core::mem::offset_of!(timespec, tv_sec) - 0usize];
675 ["Offset of field: timespec::tv_nsec"][::core::mem::offset_of!(timespec, tv_nsec) - 8usize];
676};
677#[repr(C)]
678#[derive(Debug, Default, Copy, Clone)]
679pub struct BelaCpuData {
680 #[doc = "< Number of samples (tic/toc pairs) in a acquisition cycle. Use 0 to disable."]
681 pub count: ::core::ffi::c_uint,
682 #[doc = "< Number of tics in current acquisition cycle"]
683 pub currentCount: ::core::ffi::c_uint,
684 #[doc = "< Total CPU time spent being busy (between tic and toc) during the current acquisition cycle"]
685 pub busy: ::core::ffi::c_ulonglong,
686 #[doc = "< Total CPU time (between tic and previous tic) during the current acquisition cycle"]
687 pub total: ::core::ffi::c_ulonglong,
688 #[doc = "< Time of last tic"]
689 pub tic: timespec,
690 #[doc = "< Time of last toc"]
691 pub toc: timespec,
692 #[doc = "< Average CPU usage during previous acquisition cycle"]
693 pub percentage: f32,
694}
695#[allow(clippy::unnecessary_operation, clippy::identity_op)]
696const _: () = {
697 ["Size of BelaCpuData"][::core::mem::size_of::<BelaCpuData>() - 64usize];
698 ["Alignment of BelaCpuData"][::core::mem::align_of::<BelaCpuData>() - 8usize];
699 ["Offset of field: BelaCpuData::count"][::core::mem::offset_of!(BelaCpuData, count) - 0usize];
700 ["Offset of field: BelaCpuData::currentCount"]
701 [::core::mem::offset_of!(BelaCpuData, currentCount) - 4usize];
702 ["Offset of field: BelaCpuData::busy"][::core::mem::offset_of!(BelaCpuData, busy) - 8usize];
703 ["Offset of field: BelaCpuData::total"][::core::mem::offset_of!(BelaCpuData, total) - 16usize];
704 ["Offset of field: BelaCpuData::tic"][::core::mem::offset_of!(BelaCpuData, tic) - 24usize];
705 ["Offset of field: BelaCpuData::toc"][::core::mem::offset_of!(BelaCpuData, toc) - 40usize];
706 ["Offset of field: BelaCpuData::percentage"]
707 [::core::mem::offset_of!(BelaCpuData, percentage) - 56usize];
708};
709unsafe extern "C" {
710 #[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."]
711 pub fn Bela_cpuMonitoringInit(count: ::core::ffi::c_int) -> ::core::ffi::c_int;
712}
713unsafe extern "C" {
714 #[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."]
715 pub fn Bela_cpuMonitoringGet() -> *mut BelaCpuData;
716}
717unsafe extern "C" {
718 #[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."]
719 pub fn Bela_cpuTic(data: *mut BelaCpuData);
720}
721unsafe extern "C" {
722 #[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."]
723 pub fn Bela_cpuToc(data: *mut BelaCpuData);
724}
725unsafe extern "C" {
726 #[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."]
727 pub fn Bela_setLineOutLevel(channel: ::core::ffi::c_int, decibel: f32) -> ::core::ffi::c_int;
728}
729unsafe extern "C" {
730 #[doc = " \\brief Set the level of the audio DAC.\n\n DEPRECATED.\n\n Use `Bela_setLineOutLevel()` instead."]
731 pub fn Bela_setDacLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
732}
733unsafe extern "C" {
734 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setDacLevel(-1, decibels)`."]
735 pub fn Bela_setDACLevel(decibels: f32) -> ::core::ffi::c_int;
736}
737unsafe extern "C" {
738 #[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."]
739 pub fn Bela_setAdcLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
740}
741unsafe extern "C" {
742 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAdcLevel(-1, decibels)`."]
743 pub fn Bela_setADCLevel(decibels: f32) -> ::core::ffi::c_int;
744}
745unsafe extern "C" {
746 #[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."]
747 pub fn Bela_setAudioInputGain(channel: ::core::ffi::c_int, decibels: f32)
748 -> ::core::ffi::c_int;
749}
750unsafe extern "C" {
751 #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAudioInputGain(channel, decibels)`."]
752 pub fn Bela_setPgaGain(decibels: f32, channel: ::core::ffi::c_int) -> ::core::ffi::c_int;
753}
754unsafe extern "C" {
755 #[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."]
756 pub fn Bela_setHpLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
757}
758unsafe extern "C" {
759 #[doc = " DEPRECATED\n Equivalent to Bela_setHpLevel(-1, decibels);"]
760 pub fn Bela_setHeadphoneLevel(decibels: f32) -> ::core::ffi::c_int;
761}
762unsafe extern "C" {
763 #[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."]
764 pub fn Bela_muteSpeakers(mute: ::core::ffi::c_int) -> ::core::ffi::c_int;
765}
766unsafe extern "C" {
767 #[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."]
768 pub fn Bela_createAuxiliaryTask(
769 callback: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
770 priority: ::core::ffi::c_int,
771 name: *const ::core::ffi::c_char,
772 arg: *mut ::core::ffi::c_void,
773 ) -> AuxiliaryTask;
774}
775unsafe extern "C" {
776 #[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."]
777 pub fn Bela_scheduleAuxiliaryTask(task: AuxiliaryTask) -> ::core::ffi::c_int;
778}
779unsafe extern "C" {
780 pub fn Bela_deleteAllAuxiliaryTasks();
781}