Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
|
Structure holding audio and sensor settings and pointers to I/O data buffers. More...
#include <Bela.h>
Public Attributes | |
const float *const | audioIn |
Buffer holding audio input samples. More... | |
float *const | audioOut |
Buffer holding audio output samples. More... | |
const float *const | analogIn |
Buffer holding analog input samples. More... | |
float *const | analogOut |
Buffer holding analog output samples. More... | |
uint32_t *const | digital |
Buffer holding digital input/output samples. More... | |
const uint32_t | audioFrames |
The number of audio frames per block. More... | |
const uint32_t | audioInChannels |
The number of audio input channels. | |
const uint32_t | audioOutChannels |
The number of audio output channels. | |
const float | audioSampleRate |
The audio sample rate in Hz (currently always 44100.0) | |
const uint32_t | analogFrames |
The number of analog frames per block. More... | |
const uint32_t | analogInChannels |
The number of analog input channels. More... | |
const uint32_t | analogOutChannels |
The number of analog output channels. More... | |
const float | analogSampleRate |
Analog sample rate in Hz. More... | |
const uint32_t | digitalFrames |
Number of digital frames per period. | |
const uint32_t | digitalChannels |
Number of digital channels. More... | |
const float | digitalSampleRate |
Digital sample rate in Hz (currently always 44100.0) | |
const uint64_t | audioFramesElapsed |
Number of elapsed audio frames since the start of rendering. More... | |
const uint32_t | multiplexerChannels |
Number of multiplexer channels for each analog input. More... | |
const uint32_t | multiplexerStartingChannel |
Multiplexer channel corresponding to the first analog frame. More... | |
const float *const | multiplexerAnalogIn |
Buffer which holds multiplexed analog inputs, when multiplexer capelet is enabled. More... | |
const uint32_t | audioExpanderEnabled |
Flags for whether audio expander is enabled on given analog channels. More... | |
const uint32_t | flags |
Other audio/sensor settings. More... | |
char | projectName [MAX_PROJECTNAME_LENGTH] |
Name of running project. | |
const unsigned int | underrunCount |
Number of detected underruns. | |
Structure holding audio and sensor settings and pointers to I/O data buffers.
This structure is passed to setup(), render() and cleanup() and provides access to Bela's I/O functionality. It is initialised in Bela_initAudio() based on the contents of the BelaInitSettings structure.
const float* const BelaContext::audioIn |
Buffer holding audio input samples.
This buffer allows Bela's audio input data to be read during render(). By default the buffer contains data from all the audio input channels arranged in interleaved format.
Every time render() runs this buffer is filled with a block of new audio samples. The block is made up of frames, individual slices of time consisting of one sample taken from each audio input channel simultaneously. The number of frames per block is given by context->audioFrames, and the number of audio input channels by context->audioInChannels. The length of this buffer is the product of these two values.
The buffer can be accessed manually with standard array notation or more conveniently using the audioRead() utility.
Note: this element is available in render() only.
float* const BelaContext::audioOut |
Buffer holding audio output samples.
This buffer allows Bela's audio output data to be written during render(). By default the buffer must contain data from all the audio output channels arranged in interleaved format.
Every time render() runs it is the job of the developer to fill this buffer with a block of new audio samples, structured in the same way as context->audioIn.
The buffer can be accessed manually with standard array notation or more conveniently using the audioWrite() utility.
Note: this element is available in render() only.
const float* const BelaContext::analogIn |
Buffer holding analog input samples.
This buffer allows Bela's analog input data to be read during render(). By default the buffer contains data from all the analog input channels arranged in interleaved format.
Every time render() runs this buffer is filled with a block of new analog samples. The block is made up of frames, individual slices of time consisting of one sample taken from each analog input channel simultaneously. The number of frames per block is given by context->analogFrames, and the number of analog input channels by context->analogInChannels. The length of this buffer is the product of these two values.
The buffer can be accessed manually with standard array notation or more conveniently using the analogRead() utility.
Note: this element is available in render() only.
float* const BelaContext::analogOut |
Buffer holding analog output samples.
This buffer allows Bela's analog output data to be written during render(). By default the buffer must contain data from all the analog output channels arranged in interleaved format.
Every time render() runs it is the job of the developer to fill this buffer with a block of new analog samples, structured in the same way as context->analogIn.
The buffer can be accessed manually with standard array notation or more conveniently using the analogWrite() utility.
Note: this element is available in render() only.
uint32_t* const BelaContext::digital |
Buffer holding digital input/output samples.
This buffer allows Bela's digital GPIO data to be read and written during render().
The buffer can be accessed manually with standard array notation or somewhat more conveniently using the digitalRead() and digitalWrite() utilities.
Note: this element is available in render() only.
const uint32_t BelaContext::audioFrames |
The number of audio frames per block.
Every time render() runs context->audioIn is filled with a block of new audio samples. The block is made up of frames, individual slices of time consisting of one sample taken from each audio input channel simultaneously.
This value determines the number of audio frames in each block and can be adjusted in the IDE settings tab (or via the command line arguments) from 2 to 128, defaulting to 16.
This value also determines how often render() is called, and reducing it decreases audio latency at the cost of increased CPU consumption.
const uint32_t BelaContext::analogFrames |
The number of analog frames per block.
Every time render() runs context->analogIn is filled with a block of new analog samples. The block is made up of frames, individual slices of time consisting of one sample taken from each analog input channel simultaneously.
This value determines the number of analog frames in each block. It cannot be set directly as it is dependant on the number of audio frames per block (context->audioFrames) and the analog sample rate (context->analogSampleRate).
This value will be 0 if analog I/O is disabled.
const uint32_t BelaContext::analogInChannels |
The number of analog input channels.
This will be 0 if analog I/O is disabled.
const uint32_t BelaContext::analogOutChannels |
The number of analog output channels.
This will be 0 if analog I/O is disabled.
const float BelaContext::analogSampleRate |
Analog sample rate in Hz.
This value determines the rate at which each analog input is sampled, and is directly related to the number of analog channels available. It can be adjusted in the IDE settings tab (or via the command line arguments) to 22050, 44100 or 88200, allowing 8, 4, or 2 analog channels respectively. By default, all 8 channels are sampled at 22050Hz.
If analog I/O is disabled, this value is 0.
const uint32_t BelaContext::digitalChannels |
Number of digital channels.
Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0.
const uint64_t BelaContext::audioFramesElapsed |
Number of elapsed audio frames since the start of rendering.
This holds the total number of audio frames as of the beginning of the current block. To find the current number of analog or digital frames elapsed, multiply by the ratio of the sample rates (e.g. half the number of analog frames will have elapsed if the analog sample rate is 22050).
const uint32_t BelaContext::multiplexerChannels |
Number of multiplexer channels for each analog input.
This will be 2, 4 or 8 if the multiplexer capelet is enabled, otherwise it will be 1. 2, 4 and 8 correspond to 16, 32 and 64 analog inputs, respectively.
const uint32_t BelaContext::multiplexerStartingChannel |
Multiplexer channel corresponding to the first analog frame.
This indicates the multiplexer setting corresponding to the first analog frame in the buffer.
const float* const BelaContext::multiplexerAnalogIn |
Buffer which holds multiplexed analog inputs, when multiplexer capelet is enabled.
Because the analog in buffer size may be smaller than a complete cycle of the multiplexer capelet, this buffer will always be big enough to hold at least one complete cycle of all channels. It will be null if the multiplexer capelet is not enabled.
const uint32_t BelaContext::audioExpanderEnabled |
Flags for whether audio expander is enabled on given analog channels.
Bits 0-15, when set, indicate audio expander enabled on the analog inputs. Bits 16-31 indicate audio expander enabled on the analog outputs.
const uint32_t BelaContext::flags |
Other audio/sensor settings.
Binary combination of flags including:
BELA_FLAG_INTERLEAVED BELA_FLAG_ANALOG_OUTPUTS_PERSIST BELA_FLAG_DETECT_UNDERRUNS BELA_FLAG_OFFLINE