bela-sys 0.0.1

Raw FFI bindings to the Bela core API (libbela) for Bela Gem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/* automatically generated by rust-bindgen 0.72.1 */

//! Bindings to the Bela core API, generated by `cargo xtask bindgen`
//! from BelaPlatform/Bela commit `24f04874500fa27519483d7ea00929e628c8ddb6`. Do not edit by hand.

#[doc = r" If Bindgen could only determine the size and alignment of a"]
#[doc = r" type, it is represented like this."]
#[derive(PartialEq, Copy, Clone, Debug, Hash)]
#[repr(C)]
pub struct __BindgenOpaqueArray<T: Copy, const N: usize>(pub [T; N]);
impl<T: Copy + Default, const N: usize> Default for __BindgenOpaqueArray<T, N> {
    fn default() -> Self {
        Self([<T as Default>::default(); N])
    }
}
pub const BELA_MAJOR_VERSION: u32 = 1;
pub const BELA_MINOR_VERSION: u32 = 14;
pub const BELA_BUGFIX_VERSION: u32 = 0;
pub const BELA_AUDIO_PRIORITY: u32 = 95;
pub const DEFAULT_LINE_OUT_LEVEL: f64 = 0.0;
pub const DEFAULT_PGA_GAIN: u32 = 16;
pub const DEFAULT_HP_LEVEL: f64 = -6.0;
pub const BELA_FLAG_INTERLEAVED: u32 = 1;
pub const BELA_FLAG_ANALOG_OUTPUTS_PERSIST: u32 = 2;
pub const BELA_FLAG_DETECT_UNDERRUNS: u32 = 4;
pub const BELA_FLAG_OFFLINE: u32 = 8;
pub type __off_t = ::core::ffi::c_long;
pub type __off64_t = ::core::ffi::c_long;
pub type __time_t = ::core::ffi::c_long;
pub type __syscall_slong_t = ::core::ffi::c_long;
pub type __gnuc_va_list = __BindgenOpaqueArray<u64, 4usize>;
pub type FILE = _IO_FILE;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_marker {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_codecvt {
    _unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_wide_data {
    _unused: [u8; 0],
}
pub type _IO_lock_t = ::core::ffi::c_void;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _IO_FILE {
    pub _flags: ::core::ffi::c_int,
    pub _IO_read_ptr: *mut ::core::ffi::c_char,
    pub _IO_read_end: *mut ::core::ffi::c_char,
    pub _IO_read_base: *mut ::core::ffi::c_char,
    pub _IO_write_base: *mut ::core::ffi::c_char,
    pub _IO_write_ptr: *mut ::core::ffi::c_char,
    pub _IO_write_end: *mut ::core::ffi::c_char,
    pub _IO_buf_base: *mut ::core::ffi::c_char,
    pub _IO_buf_end: *mut ::core::ffi::c_char,
    pub _IO_save_base: *mut ::core::ffi::c_char,
    pub _IO_backup_base: *mut ::core::ffi::c_char,
    pub _IO_save_end: *mut ::core::ffi::c_char,
    pub _markers: *mut _IO_marker,
    pub _chain: *mut _IO_FILE,
    pub _fileno: ::core::ffi::c_int,
    pub _flags2: ::core::ffi::c_int,
    pub _old_offset: __off_t,
    pub _cur_column: ::core::ffi::c_ushort,
    pub _vtable_offset: ::core::ffi::c_schar,
    pub _shortbuf: [::core::ffi::c_char; 1usize],
    pub _lock: *mut _IO_lock_t,
    pub _offset: __off64_t,
    pub _codecvt: *mut _IO_codecvt,
    pub _wide_data: *mut _IO_wide_data,
    pub _freeres_list: *mut _IO_FILE,
    pub _freeres_buf: *mut ::core::ffi::c_void,
    pub __pad5: usize,
    pub _mode: ::core::ffi::c_int,
    pub _unused2: [::core::ffi::c_char; 20usize],
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of _IO_FILE"][::core::mem::size_of::<_IO_FILE>() - 216usize];
    ["Alignment of _IO_FILE"][::core::mem::align_of::<_IO_FILE>() - 8usize];
    ["Offset of field: _IO_FILE::_flags"][::core::mem::offset_of!(_IO_FILE, _flags) - 0usize];
    ["Offset of field: _IO_FILE::_IO_read_ptr"]
        [::core::mem::offset_of!(_IO_FILE, _IO_read_ptr) - 8usize];
    ["Offset of field: _IO_FILE::_IO_read_end"]
        [::core::mem::offset_of!(_IO_FILE, _IO_read_end) - 16usize];
    ["Offset of field: _IO_FILE::_IO_read_base"]
        [::core::mem::offset_of!(_IO_FILE, _IO_read_base) - 24usize];
    ["Offset of field: _IO_FILE::_IO_write_base"]
        [::core::mem::offset_of!(_IO_FILE, _IO_write_base) - 32usize];
    ["Offset of field: _IO_FILE::_IO_write_ptr"]
        [::core::mem::offset_of!(_IO_FILE, _IO_write_ptr) - 40usize];
    ["Offset of field: _IO_FILE::_IO_write_end"]
        [::core::mem::offset_of!(_IO_FILE, _IO_write_end) - 48usize];
    ["Offset of field: _IO_FILE::_IO_buf_base"]
        [::core::mem::offset_of!(_IO_FILE, _IO_buf_base) - 56usize];
    ["Offset of field: _IO_FILE::_IO_buf_end"]
        [::core::mem::offset_of!(_IO_FILE, _IO_buf_end) - 64usize];
    ["Offset of field: _IO_FILE::_IO_save_base"]
        [::core::mem::offset_of!(_IO_FILE, _IO_save_base) - 72usize];
    ["Offset of field: _IO_FILE::_IO_backup_base"]
        [::core::mem::offset_of!(_IO_FILE, _IO_backup_base) - 80usize];
    ["Offset of field: _IO_FILE::_IO_save_end"]
        [::core::mem::offset_of!(_IO_FILE, _IO_save_end) - 88usize];
    ["Offset of field: _IO_FILE::_markers"][::core::mem::offset_of!(_IO_FILE, _markers) - 96usize];
    ["Offset of field: _IO_FILE::_chain"][::core::mem::offset_of!(_IO_FILE, _chain) - 104usize];
    ["Offset of field: _IO_FILE::_fileno"][::core::mem::offset_of!(_IO_FILE, _fileno) - 112usize];
    ["Offset of field: _IO_FILE::_flags2"][::core::mem::offset_of!(_IO_FILE, _flags2) - 116usize];
    ["Offset of field: _IO_FILE::_old_offset"]
        [::core::mem::offset_of!(_IO_FILE, _old_offset) - 120usize];
    ["Offset of field: _IO_FILE::_cur_column"]
        [::core::mem::offset_of!(_IO_FILE, _cur_column) - 128usize];
    ["Offset of field: _IO_FILE::_vtable_offset"]
        [::core::mem::offset_of!(_IO_FILE, _vtable_offset) - 130usize];
    ["Offset of field: _IO_FILE::_shortbuf"]
        [::core::mem::offset_of!(_IO_FILE, _shortbuf) - 131usize];
    ["Offset of field: _IO_FILE::_lock"][::core::mem::offset_of!(_IO_FILE, _lock) - 136usize];
    ["Offset of field: _IO_FILE::_offset"][::core::mem::offset_of!(_IO_FILE, _offset) - 144usize];
    ["Offset of field: _IO_FILE::_codecvt"][::core::mem::offset_of!(_IO_FILE, _codecvt) - 152usize];
    ["Offset of field: _IO_FILE::_wide_data"]
        [::core::mem::offset_of!(_IO_FILE, _wide_data) - 160usize];
    ["Offset of field: _IO_FILE::_freeres_list"]
        [::core::mem::offset_of!(_IO_FILE, _freeres_list) - 168usize];
    ["Offset of field: _IO_FILE::_freeres_buf"]
        [::core::mem::offset_of!(_IO_FILE, _freeres_buf) - 176usize];
    ["Offset of field: _IO_FILE::__pad5"][::core::mem::offset_of!(_IO_FILE, __pad5) - 184usize];
    ["Offset of field: _IO_FILE::_mode"][::core::mem::offset_of!(_IO_FILE, _mode) - 192usize];
    ["Offset of field: _IO_FILE::_unused2"][::core::mem::offset_of!(_IO_FILE, _unused2) - 196usize];
};
impl Default for _IO_FILE {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
pub type va_list = __gnuc_va_list;
unsafe extern "C" {
    pub fn rt_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn Bela_printf(format: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
}
#[doc = "< No hardware"]
pub const BelaHw_BelaHw_NoHw: BelaHw = -1;
#[doc = "< Bela"]
pub const BelaHw_BelaHw_Bela: BelaHw = 0;
#[doc = "< Bela Mini"]
pub const BelaHw_BelaHw_BelaMini: BelaHw = 1;
#[doc = "< Salt"]
pub const BelaHw_BelaHw_Salt: BelaHw = 2;
#[doc = "< Ctag Face"]
pub const BelaHw_BelaHw_CtagFace: BelaHw = 3;
#[doc = "< Ctag Beast"]
pub const BelaHw_BelaHw_CtagBeast: BelaHw = 4;
#[doc = "< Ctag Face and Bela cape"]
pub const BelaHw_BelaHw_CtagFaceBela: BelaHw = 5;
#[doc = "< Ctag Beast and Bela cape"]
pub const BelaHw_BelaHw_CtagBeastBela: BelaHw = 6;
#[doc = "< Bela Mini with extra codecs"]
pub const BelaHw_BelaHw_BelaMiniMultiAudio: BelaHw = 7;
#[doc = "< Bela Mini with extra codecs and/or tdm devices"]
pub const BelaHw_BelaHw_BelaMiniMultiTdm: BelaHw = 8;
#[doc = "< Bela with extra codecs and/or tdm devices"]
pub const BelaHw_BelaHw_BelaMultiTdm: BelaHw = 9;
#[doc = "< Bela Mini with extra rx and tx I2S data lines."]
pub const BelaHw_BelaHw_BelaMiniMultiI2s: BelaHw = 10;
#[doc = "< A Bela cape with Es9080 EVB on top, all as audio"]
pub const BelaHw_BelaHw_BelaEs9080: BelaHw = 11;
#[doc = "< A Bela cape rev C: Es9080 is used for analog outs"]
pub const BelaHw_BelaHw_BelaRevC: BelaHw = 12;
#[doc = "< Dummy offline"]
pub const BelaHw_BelaHw_Batch: BelaHw = 13;
#[doc = " A type of Bela hardware."]
pub type BelaHw = ::core::ffi::c_int;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct _BelaHwConfig {
    pub audioSampleRate: f32,
    pub audioInChannels: ::core::ffi::c_uint,
    pub audioOutChannels: ::core::ffi::c_uint,
    pub analogInChannels: ::core::ffi::c_uint,
    pub analogOutChannels: ::core::ffi::c_uint,
    pub digitalChannels: ::core::ffi::c_uint,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of _BelaHwConfig"][::core::mem::size_of::<_BelaHwConfig>() - 24usize];
    ["Alignment of _BelaHwConfig"][::core::mem::align_of::<_BelaHwConfig>() - 4usize];
    ["Offset of field: _BelaHwConfig::audioSampleRate"]
        [::core::mem::offset_of!(_BelaHwConfig, audioSampleRate) - 0usize];
    ["Offset of field: _BelaHwConfig::audioInChannels"]
        [::core::mem::offset_of!(_BelaHwConfig, audioInChannels) - 4usize];
    ["Offset of field: _BelaHwConfig::audioOutChannels"]
        [::core::mem::offset_of!(_BelaHwConfig, audioOutChannels) - 8usize];
    ["Offset of field: _BelaHwConfig::analogInChannels"]
        [::core::mem::offset_of!(_BelaHwConfig, analogInChannels) - 12usize];
    ["Offset of field: _BelaHwConfig::analogOutChannels"]
        [::core::mem::offset_of!(_BelaHwConfig, analogOutChannels) - 16usize];
    ["Offset of field: _BelaHwConfig::digitalChannels"]
        [::core::mem::offset_of!(_BelaHwConfig, digitalChannels) - 20usize];
};
pub type BelaHwConfig = _BelaHwConfig;
unsafe extern "C" {
    #[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()."]
    pub fn Bela_HwConfig_new(hw: BelaHw) -> *mut BelaHwConfig;
}
unsafe extern "C" {
    #[doc = " Use this to delete a pointer returned by Bela_HwConfig_new()"]
    pub fn Bela_HwConfig_delete(cfg: *mut BelaHwConfig);
}
#[doc = "< perform an automatic detection by scanning the peripherals and busses available, and cache value in `/run/bela/belaconfig`"]
pub const BelaHwDetectMode_BelaHwDetectMode_Scan: BelaHwDetectMode = 0;
#[doc = "< read cached value from `/run/bela/belaconfig` first. If it does not exist, fall back to #BelaHwDetectMode_Scan"]
pub const BelaHwDetectMode_BelaHwDetectMode_Cache: BelaHwDetectMode = 1;
#[doc = "<read cached value from `/run/bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
pub const BelaHwDetectMode_BelaHwDetectMode_CacheOnly: BelaHwDetectMode = 2;
#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, fall back to #BelaHwDetectMode_Cache"]
pub const BelaHwDetectMode_BelaHwDetectMode_User: BelaHwDetectMode = 3;
#[doc = "<read user-specified value from `~/.bela/belaconfig`. If it does not exist, return #BelaHw_NoHw"]
pub const BelaHwDetectMode_BelaHwDetectMode_UserOnly: BelaHwDetectMode = 4;
#[doc = " Arguments to be passed to Bela_detectHw()"]
pub type BelaHwDetectMode = ::core::ffi::c_uint;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct option {
    _unused: [u8; 0],
}
#[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."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BelaContext {
    #[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."]
    pub audioIn: *const f32,
    #[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."]
    pub audioOut: *mut f32,
    #[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."]
    pub analogIn: *const f32,
    #[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."]
    pub analogOut: *mut f32,
    #[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."]
    pub digital: *mut u32,
    #[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."]
    pub audioFrames: u32,
    #[doc = " \\brief The number of audio input channels"]
    pub audioInChannels: u32,
    #[doc = " \\brief The number of audio output channels"]
    pub audioOutChannels: u32,
    #[doc = " \\brief The audio sample rate in Hz (currently always 44100.0)"]
    pub audioSampleRate: f32,
    #[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."]
    pub analogFrames: u32,
    #[doc = " \\brief The number of analog input channels\n\n This will be 0 if analog I/O is disabled."]
    pub analogInChannels: u32,
    #[doc = " \\brief The number of analog output channels\n\n This will be 0 if analog I/O is disabled."]
    pub analogOutChannels: u32,
    #[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."]
    pub analogSampleRate: f32,
    #[doc = " Number of digital frames per period"]
    pub digitalFrames: u32,
    #[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."]
    pub digitalChannels: u32,
    #[doc = " Digital sample rate in Hz (currently always 44100.0)"]
    pub digitalSampleRate: f32,
    #[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)."]
    pub audioFramesElapsed: u64,
    #[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."]
    pub multiplexerChannels: u32,
    #[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."]
    pub multiplexerStartingChannel: u32,
    #[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."]
    pub multiplexerAnalogIn: *const f32,
    #[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."]
    pub audioExpanderEnabled: u32,
    #[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"]
    pub flags: u32,
    #[doc = " Name of running project."]
    pub projectName: [::core::ffi::c_char; 256usize],
    #[doc = " Number of detected underruns."]
    pub underrunCount: ::core::ffi::c_uint,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of BelaContext"][::core::mem::size_of::<BelaContext>() - 384usize];
    ["Alignment of BelaContext"][::core::mem::align_of::<BelaContext>() - 8usize];
    ["Offset of field: BelaContext::audioIn"]
        [::core::mem::offset_of!(BelaContext, audioIn) - 0usize];
    ["Offset of field: BelaContext::audioOut"]
        [::core::mem::offset_of!(BelaContext, audioOut) - 8usize];
    ["Offset of field: BelaContext::analogIn"]
        [::core::mem::offset_of!(BelaContext, analogIn) - 16usize];
    ["Offset of field: BelaContext::analogOut"]
        [::core::mem::offset_of!(BelaContext, analogOut) - 24usize];
    ["Offset of field: BelaContext::digital"]
        [::core::mem::offset_of!(BelaContext, digital) - 32usize];
    ["Offset of field: BelaContext::audioFrames"]
        [::core::mem::offset_of!(BelaContext, audioFrames) - 40usize];
    ["Offset of field: BelaContext::audioInChannels"]
        [::core::mem::offset_of!(BelaContext, audioInChannels) - 44usize];
    ["Offset of field: BelaContext::audioOutChannels"]
        [::core::mem::offset_of!(BelaContext, audioOutChannels) - 48usize];
    ["Offset of field: BelaContext::audioSampleRate"]
        [::core::mem::offset_of!(BelaContext, audioSampleRate) - 52usize];
    ["Offset of field: BelaContext::analogFrames"]
        [::core::mem::offset_of!(BelaContext, analogFrames) - 56usize];
    ["Offset of field: BelaContext::analogInChannels"]
        [::core::mem::offset_of!(BelaContext, analogInChannels) - 60usize];
    ["Offset of field: BelaContext::analogOutChannels"]
        [::core::mem::offset_of!(BelaContext, analogOutChannels) - 64usize];
    ["Offset of field: BelaContext::analogSampleRate"]
        [::core::mem::offset_of!(BelaContext, analogSampleRate) - 68usize];
    ["Offset of field: BelaContext::digitalFrames"]
        [::core::mem::offset_of!(BelaContext, digitalFrames) - 72usize];
    ["Offset of field: BelaContext::digitalChannels"]
        [::core::mem::offset_of!(BelaContext, digitalChannels) - 76usize];
    ["Offset of field: BelaContext::digitalSampleRate"]
        [::core::mem::offset_of!(BelaContext, digitalSampleRate) - 80usize];
    ["Offset of field: BelaContext::audioFramesElapsed"]
        [::core::mem::offset_of!(BelaContext, audioFramesElapsed) - 88usize];
    ["Offset of field: BelaContext::multiplexerChannels"]
        [::core::mem::offset_of!(BelaContext, multiplexerChannels) - 96usize];
    ["Offset of field: BelaContext::multiplexerStartingChannel"]
        [::core::mem::offset_of!(BelaContext, multiplexerStartingChannel) - 100usize];
    ["Offset of field: BelaContext::multiplexerAnalogIn"]
        [::core::mem::offset_of!(BelaContext, multiplexerAnalogIn) - 104usize];
    ["Offset of field: BelaContext::audioExpanderEnabled"]
        [::core::mem::offset_of!(BelaContext, audioExpanderEnabled) - 112usize];
    ["Offset of field: BelaContext::flags"][::core::mem::offset_of!(BelaContext, flags) - 116usize];
    ["Offset of field: BelaContext::projectName"]
        [::core::mem::offset_of!(BelaContext, projectName) - 120usize];
    ["Offset of field: BelaContext::underrunCount"]
        [::core::mem::offset_of!(BelaContext, underrunCount) - 376usize];
};
impl Default for BelaContext {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct BelaChannelGain {
    #[doc = "< Channel number. Negative value means all the channels"]
    pub channel: ::core::ffi::c_int,
    #[doc = "< Gain in dB."]
    pub gain: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of BelaChannelGain"][::core::mem::size_of::<BelaChannelGain>() - 8usize];
    ["Alignment of BelaChannelGain"][::core::mem::align_of::<BelaChannelGain>() - 4usize];
    ["Offset of field: BelaChannelGain::channel"]
        [::core::mem::offset_of!(BelaChannelGain, channel) - 0usize];
    ["Offset of field: BelaChannelGain::gain"]
        [::core::mem::offset_of!(BelaChannelGain, gain) - 4usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BelaChannelGainArray {
    pub length: ::core::ffi::c_uint,
    pub data: *mut BelaChannelGain,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of BelaChannelGainArray"][::core::mem::size_of::<BelaChannelGainArray>() - 16usize];
    ["Alignment of BelaChannelGainArray"][::core::mem::align_of::<BelaChannelGainArray>() - 8usize];
    ["Offset of field: BelaChannelGainArray::length"]
        [::core::mem::offset_of!(BelaChannelGainArray, length) - 0usize];
    ["Offset of field: BelaChannelGainArray::data"]
        [::core::mem::offset_of!(BelaChannelGainArray, data) - 8usize];
};
impl Default for BelaChannelGainArray {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[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."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct BelaInitSettings {
    #[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."]
    pub periodSize: ::core::ffi::c_int,
    #[doc = " Whether to use the analog input and output"]
    pub useAnalog: ::core::ffi::c_int,
    #[doc = " Whether to use the 16 programmable GPIOs"]
    pub useDigital: ::core::ffi::c_int,
    #[doc = " How many audio input channels [ignored]"]
    pub numAudioInChannels: ::core::ffi::c_int,
    #[doc = " How many audio out channels [ignored]"]
    pub numAudioOutChannels: ::core::ffi::c_int,
    #[doc = " How many analog input channels"]
    pub numAnalogInChannels: ::core::ffi::c_int,
    #[doc = " How many analog output channels"]
    pub numAnalogOutChannels: ::core::ffi::c_int,
    #[doc = " How many channels for the GPIOs"]
    pub numDigitalChannels: ::core::ffi::c_int,
    #[doc = " Whether to begin with the speakers muted"]
    pub beginMuted: ::core::ffi::c_int,
    #[doc = " Level for the audio DAC output. DEPRECATED: ues lineOutGains"]
    pub dacLevel: f32,
    #[doc = " Level for the audio ADC input. DEPRECATED: use audioInputGains"]
    pub adcLevel: f32,
    #[doc = " Gains for the PGA, left and right channels. DEPRECATED: use audioInputGains"]
    pub pgaGain: [f32; 2usize],
    #[doc = " Level for the headphone output. DEPRECATED: use headphoneGains"]
    pub headphoneLevel: f32,
    #[doc = " How many channels to use on the multiplexer capelet, if enabled"]
    pub numMuxChannels: ::core::ffi::c_int,
    #[doc = " Which audio expander settings to use on the input"]
    pub audioExpanderInputs: ::core::ffi::c_uint,
    #[doc = " Which audio expander settings to use on the input"]
    pub audioExpanderOutputs: ::core::ffi::c_uint,
    #[doc = " Which PRU (0 or 1) the code should run on"]
    pub pruNumber: ::core::ffi::c_int,
    #[doc = " The external .bin file to load. If empty will use PRU code from pru_rtaudio_bin.h"]
    pub pruFilename: [::core::ffi::c_char; 256usize],
    #[doc = " Whether to detect and log underruns"]
    pub detectUnderruns: ::core::ffi::c_int,
    #[doc = " Whether to use verbose logging"]
    pub verbose: ::core::ffi::c_int,
    #[doc = " Whether to use the blinking LED to indicate Bela is running"]
    pub enableLED: ::core::ffi::c_int,
    #[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."]
    pub stopButtonPin: ::core::ffi::c_int,
    #[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"]
    pub highPerformanceMode: ::core::ffi::c_int,
    #[doc = " Whether audio/analog data should be interleaved"]
    pub interleave: ::core::ffi::c_int,
    #[doc = " \\brief Whether analog outputs should persist to future frames.\n\n n.b. digital pins always persist, audio never does"]
    pub analogOutputsPersist: ::core::ffi::c_int,
    #[doc = " \\brief Whether the analog channels should be resampled to\n audio sampling rate."]
    pub uniformSampleRate: ::core::ffi::c_int,
    #[doc = " \\brief The requested stack size for the audio thread. Defaults"]
    pub audioThreadStackSize: ::core::ffi::c_uint,
    #[doc = " \\brief The requested stack size for each AuxilaryTask. Defaults"]
    pub auxiliaryTaskStackSize: ::core::ffi::c_uint,
    pub setup: ::core::option::Option<
        unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void) -> bool,
    >,
    pub render: ::core::option::Option<
        unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
    >,
    pub cleanup: ::core::option::Option<
        unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
    >,
    #[doc = " Pin where amplifier mute can be found"]
    pub ampMutePin: ::core::ffi::c_int,
    #[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."]
    pub audioThreadDone: ::core::option::Option<
        unsafe extern "C" fn(arg1: *mut BelaContext, arg2: *mut ::core::ffi::c_void),
    >,
    #[doc = " A codec-specific intialisation parameter"]
    pub codecMode: *mut ::core::ffi::c_char,
    #[doc = " audio input gains"]
    pub audioInputGains: BelaChannelGainArray,
    #[doc = " level for headphone outputs"]
    pub headphoneGains: BelaChannelGainArray,
    #[doc = " Level for the audio ADC input DEPRECATED: use audioInputGains"]
    pub adcGains: BelaChannelGainArray,
    #[doc = " Level for the audio line level output"]
    pub lineOutGains: BelaChannelGainArray,
    #[doc = " A bitmask of disabled digital channels"]
    pub disabledDigitalChannels: u32,
    pub unused: [::core::ffi::c_char; 220usize],
    #[doc = " User selected board to work with (as opposed to detected hardware)."]
    pub board: BelaHw,
    #[doc = " Name of running project."]
    pub projectName: *mut ::core::ffi::c_char,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of BelaInitSettings"][::core::mem::size_of::<BelaInitSettings>() - 720usize];
    ["Alignment of BelaInitSettings"][::core::mem::align_of::<BelaInitSettings>() - 8usize];
    ["Offset of field: BelaInitSettings::periodSize"]
        [::core::mem::offset_of!(BelaInitSettings, periodSize) - 0usize];
    ["Offset of field: BelaInitSettings::useAnalog"]
        [::core::mem::offset_of!(BelaInitSettings, useAnalog) - 4usize];
    ["Offset of field: BelaInitSettings::useDigital"]
        [::core::mem::offset_of!(BelaInitSettings, useDigital) - 8usize];
    ["Offset of field: BelaInitSettings::numAudioInChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numAudioInChannels) - 12usize];
    ["Offset of field: BelaInitSettings::numAudioOutChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numAudioOutChannels) - 16usize];
    ["Offset of field: BelaInitSettings::numAnalogInChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numAnalogInChannels) - 20usize];
    ["Offset of field: BelaInitSettings::numAnalogOutChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numAnalogOutChannels) - 24usize];
    ["Offset of field: BelaInitSettings::numDigitalChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numDigitalChannels) - 28usize];
    ["Offset of field: BelaInitSettings::beginMuted"]
        [::core::mem::offset_of!(BelaInitSettings, beginMuted) - 32usize];
    ["Offset of field: BelaInitSettings::dacLevel"]
        [::core::mem::offset_of!(BelaInitSettings, dacLevel) - 36usize];
    ["Offset of field: BelaInitSettings::adcLevel"]
        [::core::mem::offset_of!(BelaInitSettings, adcLevel) - 40usize];
    ["Offset of field: BelaInitSettings::pgaGain"]
        [::core::mem::offset_of!(BelaInitSettings, pgaGain) - 44usize];
    ["Offset of field: BelaInitSettings::headphoneLevel"]
        [::core::mem::offset_of!(BelaInitSettings, headphoneLevel) - 52usize];
    ["Offset of field: BelaInitSettings::numMuxChannels"]
        [::core::mem::offset_of!(BelaInitSettings, numMuxChannels) - 56usize];
    ["Offset of field: BelaInitSettings::audioExpanderInputs"]
        [::core::mem::offset_of!(BelaInitSettings, audioExpanderInputs) - 60usize];
    ["Offset of field: BelaInitSettings::audioExpanderOutputs"]
        [::core::mem::offset_of!(BelaInitSettings, audioExpanderOutputs) - 64usize];
    ["Offset of field: BelaInitSettings::pruNumber"]
        [::core::mem::offset_of!(BelaInitSettings, pruNumber) - 68usize];
    ["Offset of field: BelaInitSettings::pruFilename"]
        [::core::mem::offset_of!(BelaInitSettings, pruFilename) - 72usize];
    ["Offset of field: BelaInitSettings::detectUnderruns"]
        [::core::mem::offset_of!(BelaInitSettings, detectUnderruns) - 328usize];
    ["Offset of field: BelaInitSettings::verbose"]
        [::core::mem::offset_of!(BelaInitSettings, verbose) - 332usize];
    ["Offset of field: BelaInitSettings::enableLED"]
        [::core::mem::offset_of!(BelaInitSettings, enableLED) - 336usize];
    ["Offset of field: BelaInitSettings::stopButtonPin"]
        [::core::mem::offset_of!(BelaInitSettings, stopButtonPin) - 340usize];
    ["Offset of field: BelaInitSettings::highPerformanceMode"]
        [::core::mem::offset_of!(BelaInitSettings, highPerformanceMode) - 344usize];
    ["Offset of field: BelaInitSettings::interleave"]
        [::core::mem::offset_of!(BelaInitSettings, interleave) - 348usize];
    ["Offset of field: BelaInitSettings::analogOutputsPersist"]
        [::core::mem::offset_of!(BelaInitSettings, analogOutputsPersist) - 352usize];
    ["Offset of field: BelaInitSettings::uniformSampleRate"]
        [::core::mem::offset_of!(BelaInitSettings, uniformSampleRate) - 356usize];
    ["Offset of field: BelaInitSettings::audioThreadStackSize"]
        [::core::mem::offset_of!(BelaInitSettings, audioThreadStackSize) - 360usize];
    ["Offset of field: BelaInitSettings::auxiliaryTaskStackSize"]
        [::core::mem::offset_of!(BelaInitSettings, auxiliaryTaskStackSize) - 364usize];
    ["Offset of field: BelaInitSettings::setup"]
        [::core::mem::offset_of!(BelaInitSettings, setup) - 368usize];
    ["Offset of field: BelaInitSettings::render"]
        [::core::mem::offset_of!(BelaInitSettings, render) - 376usize];
    ["Offset of field: BelaInitSettings::cleanup"]
        [::core::mem::offset_of!(BelaInitSettings, cleanup) - 384usize];
    ["Offset of field: BelaInitSettings::ampMutePin"]
        [::core::mem::offset_of!(BelaInitSettings, ampMutePin) - 392usize];
    ["Offset of field: BelaInitSettings::audioThreadDone"]
        [::core::mem::offset_of!(BelaInitSettings, audioThreadDone) - 400usize];
    ["Offset of field: BelaInitSettings::codecMode"]
        [::core::mem::offset_of!(BelaInitSettings, codecMode) - 408usize];
    ["Offset of field: BelaInitSettings::audioInputGains"]
        [::core::mem::offset_of!(BelaInitSettings, audioInputGains) - 416usize];
    ["Offset of field: BelaInitSettings::headphoneGains"]
        [::core::mem::offset_of!(BelaInitSettings, headphoneGains) - 432usize];
    ["Offset of field: BelaInitSettings::adcGains"]
        [::core::mem::offset_of!(BelaInitSettings, adcGains) - 448usize];
    ["Offset of field: BelaInitSettings::lineOutGains"]
        [::core::mem::offset_of!(BelaInitSettings, lineOutGains) - 464usize];
    ["Offset of field: BelaInitSettings::disabledDigitalChannels"]
        [::core::mem::offset_of!(BelaInitSettings, disabledDigitalChannels) - 480usize];
    ["Offset of field: BelaInitSettings::unused"]
        [::core::mem::offset_of!(BelaInitSettings, unused) - 484usize];
    ["Offset of field: BelaInitSettings::board"]
        [::core::mem::offset_of!(BelaInitSettings, board) - 704usize];
    ["Offset of field: BelaInitSettings::projectName"]
        [::core::mem::offset_of!(BelaInitSettings, projectName) - 712usize];
};
impl Default for BelaInitSettings {
    fn default() -> Self {
        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[doc = " \\ingroup auxtask\n\n Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and\n automatically cleaned up after cleanup() finishes."]
pub type AuxiliaryTask = *mut ::core::ffi::c_void;
unsafe extern "C" {
    #[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."]
    pub fn Bela_InitSettings_alloc() -> *mut BelaInitSettings;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_InitSettings_free(settings: *mut BelaInitSettings);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_defaultSettings(settings: *mut BelaInitSettings);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_userSettings(settings: *mut BelaInitSettings);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_getopt_long(
        argc: ::core::ffi::c_int,
        argv: *const *mut ::core::ffi::c_char,
        customShortOptions: *const ::core::ffi::c_char,
        customLongOptions: *const option,
        settings: *mut BelaInitSettings,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_usage();
}
unsafe extern "C" {
    #[doc = " \\brief Get the version of Bela you are running."]
    pub fn Bela_getVersion(
        major: *mut ::core::ffi::c_int,
        minor: *mut ::core::ffi::c_int,
        bugfix: *mut ::core::ffi::c_int,
    );
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setVerboseLevel(level: ::core::ffi::c_int);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_detectHw(mode: BelaHwDetectMode) -> BelaHw;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_initAudio(
        settings: *mut BelaInitSettings,
        userData: *mut ::core::ffi::c_void,
    ) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_startAudio() -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_runInSameThread() -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_stopAudio();
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_cleanupAudio();
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setUserData(newUserData: *mut ::core::ffi::c_void);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_requestStop();
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_stopRequested() -> ::core::ffi::c_int;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct timespec {
    pub tv_sec: __time_t,
    pub tv_nsec: __syscall_slong_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of timespec"][::core::mem::size_of::<timespec>() - 16usize];
    ["Alignment of timespec"][::core::mem::align_of::<timespec>() - 8usize];
    ["Offset of field: timespec::tv_sec"][::core::mem::offset_of!(timespec, tv_sec) - 0usize];
    ["Offset of field: timespec::tv_nsec"][::core::mem::offset_of!(timespec, tv_nsec) - 8usize];
};
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct BelaCpuData {
    #[doc = "< Number of samples (tic/toc pairs) in a acquisition cycle. Use 0 to disable."]
    pub count: ::core::ffi::c_uint,
    #[doc = "< Number of tics in current acquisition cycle"]
    pub currentCount: ::core::ffi::c_uint,
    #[doc = "< Total CPU time spent being busy (between tic and toc) during the current acquisition cycle"]
    pub busy: ::core::ffi::c_ulonglong,
    #[doc = "< Total CPU time (between tic and previous tic) during the current acquisition cycle"]
    pub total: ::core::ffi::c_ulonglong,
    #[doc = "< Time of last tic"]
    pub tic: timespec,
    #[doc = "< Time of last toc"]
    pub toc: timespec,
    #[doc = "< Average CPU usage during previous acquisition cycle"]
    pub percentage: f32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
    ["Size of BelaCpuData"][::core::mem::size_of::<BelaCpuData>() - 64usize];
    ["Alignment of BelaCpuData"][::core::mem::align_of::<BelaCpuData>() - 8usize];
    ["Offset of field: BelaCpuData::count"][::core::mem::offset_of!(BelaCpuData, count) - 0usize];
    ["Offset of field: BelaCpuData::currentCount"]
        [::core::mem::offset_of!(BelaCpuData, currentCount) - 4usize];
    ["Offset of field: BelaCpuData::busy"][::core::mem::offset_of!(BelaCpuData, busy) - 8usize];
    ["Offset of field: BelaCpuData::total"][::core::mem::offset_of!(BelaCpuData, total) - 16usize];
    ["Offset of field: BelaCpuData::tic"][::core::mem::offset_of!(BelaCpuData, tic) - 24usize];
    ["Offset of field: BelaCpuData::toc"][::core::mem::offset_of!(BelaCpuData, toc) - 40usize];
    ["Offset of field: BelaCpuData::percentage"]
        [::core::mem::offset_of!(BelaCpuData, percentage) - 56usize];
};
unsafe extern "C" {
    #[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."]
    pub fn Bela_cpuMonitoringInit(count: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_cpuMonitoringGet() -> *mut BelaCpuData;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_cpuTic(data: *mut BelaCpuData);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_cpuToc(data: *mut BelaCpuData);
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setLineOutLevel(channel: ::core::ffi::c_int, decibel: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " \\brief Set the level of the audio DAC.\n\n DEPRECATED.\n\n Use `Bela_setLineOutLevel()` instead."]
    pub fn Bela_setDacLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setDacLevel(-1, decibels)`."]
    pub fn Bela_setDACLevel(decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setAdcLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAdcLevel(-1, decibels)`."]
    pub fn Bela_setADCLevel(decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setAudioInputGain(channel: ::core::ffi::c_int, decibels: f32)
    -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " DEPRECATED.\n\n Equivalent to `Bela_setAudioInputGain(channel, decibels)`."]
    pub fn Bela_setPgaGain(decibels: f32, channel: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_setHpLevel(channel: ::core::ffi::c_int, decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[doc = " DEPRECATED\n Equivalent to Bela_setHpLevel(-1, decibels);"]
    pub fn Bela_setHeadphoneLevel(decibels: f32) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_muteSpeakers(mute: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_createAuxiliaryTask(
        callback: ::core::option::Option<unsafe extern "C" fn(arg1: *mut ::core::ffi::c_void)>,
        priority: ::core::ffi::c_int,
        name: *const ::core::ffi::c_char,
        arg: *mut ::core::ffi::c_void,
    ) -> AuxiliaryTask;
}
unsafe extern "C" {
    #[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."]
    pub fn Bela_scheduleAuxiliaryTask(task: AuxiliaryTask) -> ::core::ffi::c_int;
}
unsafe extern "C" {
    pub fn Bela_deleteAllAuxiliaryTasks();
}