Expand description
Raw FFI bindings to the Bela core API (libbela) for Bela Gem.
This crate exposes the C surface of the Bela core API (Bela.h):
BelaContext, BelaInitSettings, the Bela_* lifecycle and
auxiliary-task functions, and rt_printf. Bindings are generated
from vendored headers (see vendor/bela/COMMIT for the pinned
upstream commit) with cargo xtask bindgen; see the crate README
for how to regenerate them. Higher-level C++ libraries (Scope,
Trill, Fft, Gui, Midi) are out of scope.
The setup / render / cleanup callbacks are not bound: they are
either provided to Bela_initAudio via BelaInitSettings or
defined as #[unsafe(no_mangle)] symbols by the linking crate.
Target platform is Bela Gem on PocketBeagle 2
(aarch64-unknown-linux-gnu). For a safe API, use the bela
crate instead.
Structs§
- Bela
Channel Gain - Bela
Channel Gain Array - Bela
Context - \ingroup render \brief Structure holding audio and sensor settings and pointers to I/O data buffers.
- Bela
CpuData - Bela
Init Settings - \ingroup control \brief Structure containing initialisation parameters for the real-time audio control system.
- _Bela
HwConfig - _IO_
FILE - _IO_
codecvt - _IO_
marker - _IO_
wide_ data - __
Bindgen Opaque Array - If Bindgen could only determine the size and alignment of a type, it is represented like this.
- option
- timespec
Constants§
- BELA_
AUDIO_ PRIORITY - BELA_
BUGFIX_ VERSION - BELA_
FLAG_ ANALOG_ OUTPUTS_ PERSIST - BELA_
FLAG_ DETECT_ UNDERRUNS - BELA_
FLAG_ INTERLEAVED - BELA_
FLAG_ OFFLINE - BELA_
MAJOR_ VERSION - BELA_
MINOR_ VERSION - Bela
HwDetect Mode_ Bela HwDetect Mode_ Cache - < read cached value from
/run/bela/belaconfigfirst. If it does not exist, fall back to #BelaHwDetectMode_Scan - Bela
HwDetect Mode_ Bela HwDetect Mode_ Cache Only - <read cached value from
/run/bela/belaconfig. If it does not exist, return #BelaHw_NoHw - Bela
HwDetect Mode_ Bela HwDetect Mode_ Scan - < perform an automatic detection by scanning the peripherals and busses available, and cache value in
/run/bela/belaconfig - Bela
HwDetect Mode_ Bela HwDetect Mode_ User - <read user-specified value from
~/.bela/belaconfig. If it does not exist, fall back to #BelaHwDetectMode_Cache - Bela
HwDetect Mode_ Bela HwDetect Mode_ User Only - <read user-specified value from
~/.bela/belaconfig. If it does not exist, return #BelaHw_NoHw - Bela
Hw_ Bela Hw_ Batch - < Dummy offline
- Bela
Hw_ Bela Hw_ Bela - < Bela
- Bela
Hw_ Bela Hw_ Bela Es9080 - < A Bela cape with Es9080 EVB on top, all as audio
- Bela
Hw_ Bela Hw_ Bela Mini - < Bela Mini
- Bela
Hw_ Bela Hw_ Bela Mini Multi Audio - < Bela Mini with extra codecs
- Bela
Hw_ Bela Hw_ Bela Mini Multi I2s - < Bela Mini with extra rx and tx I2S data lines.
- Bela
Hw_ Bela Hw_ Bela Mini Multi Tdm - < Bela Mini with extra codecs and/or tdm devices
- Bela
Hw_ Bela Hw_ Bela Multi Tdm - < Bela with extra codecs and/or tdm devices
- Bela
Hw_ Bela Hw_ Bela RevC - < A Bela cape rev C: Es9080 is used for analog outs
- Bela
Hw_ Bela Hw_ Ctag Beast - < Ctag Beast
- Bela
Hw_ Bela Hw_ Ctag Beast Bela - < Ctag Beast and Bela cape
- Bela
Hw_ Bela Hw_ Ctag Face - < Ctag Face
- Bela
Hw_ Bela Hw_ Ctag Face Bela - < Ctag Face and Bela cape
- Bela
Hw_ Bela Hw_ NoHw - < No hardware
- Bela
Hw_ Bela Hw_ Salt - < Salt
- DEFAULT_
HP_ LEVEL - DEFAULT_
LINE_ OUT_ LEVEL - DEFAULT_
PGA_ GAIN
Functions§
- Bela_
HwConfig_ ⚠delete - Use this to delete a pointer returned by Bela_HwConfig_new()
- Bela_
HwConfig_ ⚠new - Returns the configuration for a given BelaHw or
nullptrifhwis invalid. - Bela_
Init ⚠Settings_ alloc - \brief Allocate the data structure containing settings for Bela.
- Bela_
Init ⚠Settings_ free - \brief De-allocate the data structure containing settings for Bela.
- Bela_
cleanup ⚠Audio - \brief Clean up resources from audio and sensor processing.
- Bela_
cpuMonitoring ⚠Get - Get stats about internal CPU monitoring.
- Bela_
cpuMonitoring ⚠Init - Set internal CPU monitoring for the audio thread. @param count Number of samples (tic/toc pairs) in a acquisition cycle. Use 0 to disable. @return 0 on success, an error code otherwise.
- Bela_
cpuTic ⚠ - Start measuring CPU time. When
data->currentCountreachesdata->count, a acquisition cycle is completed.data->percentagegives the average CPU busy time during the latest completed acquisition cycle. - Bela_
cpuToc ⚠ - Stop measuring CPU time.
- Bela_
create ⚠Auxiliary Task - \brief Create a new auxiliary task.
- Bela_
default ⚠Settings - \brief Initialise the data structure containing settings for Bela.
- Bela_
delete ⚠AllAuxiliary Tasks - Bela_
detect ⚠Hw - \brief Detect what hardware we are running on.
- Bela_
getVersion ⚠ - \brief Get the version of Bela you are running.
- Bela_
getopt_ ⚠long - \brief Get long options from command line argument list, including Bela standard options
- Bela_
init ⚠Audio - \brief Initialise audio and sensor rendering environment.
- Bela_
mute ⚠Speakers - \brief Mute or unmute the onboard speaker amplifiers.
- Bela_
printf ⚠ - Bela_
request ⚠Stop - \brief Tell the Bela program to stop.
- Bela_
runIn ⚠Same Thread - \brief Begin processing audio and sensor data in the same thread as the caller.
- Bela_
schedule ⚠Auxiliary Task - \brief Run an auxiliary task which has previously been created.
- Bela_
setADC ⚠Level - DEPRECATED.
- Bela_
setAdc ⚠Level - \brief Set the level of the audio ADC.
- Bela_
setAudio ⚠Input Gain - \brief Set the gain of the audio input preamplifier.
- Bela_
setDAC ⚠Level - DEPRECATED.
- Bela_
setDac ⚠Level - \brief Set the level of the audio DAC.
- Bela_
setHeadphone ⚠Level - DEPRECATED Equivalent to Bela_setHpLevel(-1, decibels);
- Bela_
setHp ⚠Level - \brief Set the level of the onboard headphone amplifier.
- Bela_
setLine ⚠OutLevel - \brief Set the level of the audio line out.
- Bela_
setPga ⚠Gain - DEPRECATED.
- Bela_
setUser ⚠Data - \brief Set the
userDatavariable, which is passed to setup(), render() and cleanup(). - Bela_
setVerbose ⚠Level - \brief Set level of verbose (debugging) printing.
- Bela_
start ⚠Audio - \brief Begin processing audio and sensor data.
- Bela_
stop ⚠Audio - \brief Stop processing audio and sensor data.
- Bela_
stop ⚠Requested - \brief Check whether the program should stop.
- Bela_
usage ⚠ - \brief Print usage information for Bela standard options.
- Bela_
user ⚠Settings - \brief Initialise the data structure containing settings for Bela.
- rt_
printf ⚠
Type Aliases§
- Auxiliary
Task - \ingroup auxtask
- BelaHw
- A type of Bela hardware.
- Bela
HwConfig - Bela
HwDetect Mode - Arguments to be passed to Bela_detectHw()
- FILE
- _IO_
lock_ t - __
gnuc_ va_ list - __
off64_ t - __off_t
- __
syscall_ slong_ t - __
time_ t - va_list