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