Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
|
Enumerations | |
enum | { INPUT = 0, OUTPUT = 1 } |
static float | audioRead (BelaContext *context, int frame, int channel) |
Read an audio input, specifying the frame number (when to read) and the channel. More... | |
static float | audioReadNI (BelaContext *context, int frame, int channel) |
Non-interleaved version of audioRead() More... | |
static void | audioWrite (BelaContext *context, int frame, int channel, float value) |
Write an audio output, specifying the frame number (when to write) and the channel. More... | |
static void | audioWriteNI (BelaContext *context, int frame, int channel, float value) |
Non-interleaved version of audioWrite() More... | |
static float | analogRead (BelaContext *context, int frame, int channel) |
Read an analog input, specifying the frame number (when to read) and the channel. More... | |
static float | analogReadNI (BelaContext *context, int frame, int channel) |
Non-interleaved version of analogRead() More... | |
static void | analogWrite (BelaContext *context, int frame, int channel, float value) |
Write an analog output, specifying the frame number (when to write) and the channel. More... | |
static void | analogWriteNI (BelaContext *context, int frame, int channel, float value) |
Non-interleaved version of analogWrite() More... | |
static void | analogWriteOnce (BelaContext *context, int frame, int channel, float value) |
Write an analog output, specifying the frame number (when to write) and the channel. More... | |
static void | analogWriteOnceNI (BelaContext *context, int frame, int channel, float value) |
Non-interleaved version of analogWriteNI() More... | |
static int | digitalRead (BelaContext *context, int frame, int channel) |
Read a digital input, specifying the frame number (when to read) and the pin. More... | |
static void | digitalWrite (BelaContext *context, int frame, int channel, int value) |
Write a digital output, specifying the frame number (when to write) and the pin. More... | |
static void | digitalWriteOnce (BelaContext *context, int frame, int channel, int value) |
Write a digital output, specifying the frame number (when to write) and the pin. More... | |
static void | pinMode (BelaContext *context, int frame, int channel, int mode) |
Set the direction of a digital pin to input or output. More... | |
static void | pinModeOnce (BelaContext *context, int frame, int channel, int mode) |
Set the direction of a digital pin to input or output. More... | |
static float | multiplexerAnalogRead (BelaContext *context, int input, int muxChannel) |
Read an audio input, specifying the frame number (when to read) and the channel. More... | |
static unsigned int | multiplexerChannelForFrame (BelaContext *context, int frame) |
Read an audio input, specifying the frame number (when to read) and the channel. More... | |
These functions and macros are used for audio, analog and digital I/O. All the I/O functions require the BelaContext data structure from render() to be passed in. This means that these functions are, by design, only usable from within the rendering thread.
The naming conventions are loosely derived from the Arduino environment, and the syntax is similar. Unlike Arduino, the I/O functions require the frame number at which the read or write should take place, since all I/O happens synchronously with the audio clock.
|
inlinestatic |
Read an audio input, specifying the frame number (when to read) and the channel.
This function returns the value of an audio input, at the time indicated by frame
. The returned value ranges from -1 to 1.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to read the audio input. Valid values range from 0 to (context->audioFrames - 1). |
channel | Which audio input to read. Valid values are between 0 and (context->audioChannels - 1), typically 0 to 1 by default. |
|
inlinestatic |
Non-interleaved version of audioRead()
To be used when (context->flags | BELA_FLAG_INTERLEAVED) == false)
|
inlinestatic |
Write an audio output, specifying the frame number (when to write) and the channel.
This function sets the value of an audio output, at the time indicated by frame
. Valid values are between -1 and 1.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to write the audio output. Valid values range from 0 to (context->audioFrames - 1). |
channel | Which analog output to write. Valid values are between 0 and (context->audioChannels - 1), typically 0 to 1 by default. |
value | Value to write to the output, range -1 to 1. |
|
inlinestatic |
Non-interleaved version of audioWrite()
To be used when (context->flags | BELA_FLAG_INTERLEAVED) == false)
|
inlinestatic |
Read an analog input, specifying the frame number (when to read) and the channel.
This function returns the value of an analog input, at the time indicated by frame
. The returned value ranges from 0 to 1, corresponding to a voltage range of 0 to 4.096V.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to read the analog input. Valid values range from 0 to (context->analogFrames - 1). |
channel | Which analog input to read. Valid values are between 0 and (context->analogInChannels - 1), typically 0 to 7 by default. |
|
inlinestatic |
Non-interleaved version of analogRead()
To be used when (context->flags | BELA_FLAG_INTERLEAVED) == false)
|
inlinestatic |
Write an analog output, specifying the frame number (when to write) and the channel.
This function sets the value of an analog output, at the time indicated by frame
. Valid values are between 0 and 1, corresponding to the range 0 to 5V.
The value written will persist for all future frames if BELA_FLAG_ANALOG_OUTPUTS_PERSIST is set in context->flags. This is the default behaviour.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to write the analog output. Valid values range from 0 to (context->analogFrames - 1). |
channel | Which analog output to write. Valid values are between 0 and (context->analogOutChannels - 1), typically 0 to 7 by default. |
value | Value to write to the output, range 0 to 1. |
|
inlinestatic |
Non-interleaved version of analogWrite()
To be used when (context->flags | BELA_FLAG_INTERLEAVED) == false)
|
inlinestatic |
Write an analog output, specifying the frame number (when to write) and the channel.
This function sets the value of an analog output, at the time indicated by frame
. Valid values are between 0 and 1, corresponding to the range 0 to 5V.
Unlike analogWrite(), the value written will affect only the frame specified, with future values unchanged. This is faster than analogWrite() so is better suited to applications where every frame will be written to a different value. If BELA_FLAG_ANALOG_OUTPUTS_PERSIST is not set within context->flags, then analogWriteOnce() and analogWrite() are equivalent.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to write the analog output. Valid values range from 0 to (context->analogFrames - 1). |
channel | Which analog output to write. Valid values are between 0 and (context->analogOutChannels - 1), typically 0 to 7 by default. |
value | Value to write to the output, range 0 to 1. |
|
inlinestatic |
Non-interleaved version of analogWriteNI()
To be used when (context->flags | BELA_FLAG_INTERLEAVED) == false)
|
inlinestatic |
Read a digital input, specifying the frame number (when to read) and the pin.
This function returns the value of a digital input, at the time indicated by frame
. The value is 0 if the pin is low, and nonzero if the pin is high (3.3V).
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to read the digital input. Valid values range from 0 to (context->digitalFrames - 1). |
channel | Which digital input to read. 16 pins across the headers are available. Check your board diagram to know where they are on the specific board you have. |
|
inlinestatic |
Write a digital output, specifying the frame number (when to write) and the pin.
This function sets the value of a digital output, at the time indicated by frame
. A value of 0 sets the pin low; any other value sets the pin high (3.3V).
The value written will persist for all future frames.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to write the digital output. Valid values range from 0 to (context->digitalFrames - 1). |
channel | Which digital output to write. 16 pins across the headers are available. Check your board diagram to know where they are on the specific board you have. |
value | Value to write to the output. |
|
inlinestatic |
Write a digital output, specifying the frame number (when to write) and the pin.
This function sets the value of a digital output, at the time indicated by frame
. A value of 0 sets the pin low; any other value sets the pin high (3.3V).
Unlike digitalWrite(), the value written will affect only the frame specified, with future values unchanged. This is faster than digitalWrite() so is better suited to applications where every frame will be written to a different value.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to write the digital output. Valid values range from 0 to (context->digitalFrames - 1). |
channel | Which digital output to write. 16 pins across the headers are available. Check your board diagram to know where they are on the specific board you have. |
value | Value to write to the output. |
|
inlinestatic |
Set the direction of a digital pin to input or output.
This function sets the direction of a digital pin, at the time indicated by frame
. Valid values are INPUT
and OUTPUT
. All pins begin as inputs by default.
The value written will persist for all future frames.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to set the pin direction. Valid values range from 0 to (context->digitalFrames - 1). |
channel | Which digital channel to set. 16 pins across the headers are available. Check your board diagram to know where they are on the specific board you have. |
mode | Direction of the pin (INPUT or OUTPUT ). |
|
inlinestatic |
Set the direction of a digital pin to input or output.
This function sets the direction of a digital pin, at the time indicated by frame
. Valid values are INPUT
and OUTPUT
. All pins begin as inputs by default.
The value written will affect only the specified frame.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to set the pin direction. Valid values range from 0 to (context->digitalFrames - 1). |
channel | Which digital channel to set. 16 pins across the headers are available. Check your board diagram to know where they are on the specific board you have. |
mode | Direction of the pin (INPUT or OUTPUT ). |
|
inlinestatic |
Read an audio input, specifying the frame number (when to read) and the channel.
This function returns the value of an audio input, at the time indicated by frame
. The returned value ranges from -1 to 1.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to read the audio input. Valid values range from 0 to (context->audioFrames - 1). |
channel | Which audio input to read. Valid values are between 0 and (context->audioChannels - 1), typically 0 to 1 by default. |
|
inlinestatic |
Read an audio input, specifying the frame number (when to read) and the channel.
This function returns the value of an audio input, at the time indicated by frame
. The returned value ranges from -1 to 1.
context | The I/O data structure which is passed by Bela to render(). |
frame | Which frame (i.e. what time) to read the audio input. Valid values range from 0 to (context->audioFrames - 1). |
channel | Which audio input to read. Valid values are between 0 and (context->audioChannels - 1), typically 0 to 1 by default. |