Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
Macros | Functions
Utilities.h File Reference

Wiring-inspired utility functions and macros. More...

#include "Bela.h"

Go to the source code of this file.

Macros

#define INPUT   0x0
 
#define OUTPUT   0x1
 

Functions

static float map (float x, float in_min, float in_max, float out_min, float out_max)
 Linearly rescale a number from one range of values to another. More...
 
static float constrain (float x, float min_val, float max_val)
 Constrain a number to stay within a given range. More...
 
static float min (float x, float y)
 Returns the maximum of two numbers. More...
 
static float max (float x, float y)
 Returns the minimum of two numbers. More...
 
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)
 
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)
 
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)
 
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)
 
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)
 
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...
 

Detailed Description

Wiring-inspired utility functions and macros.

Macros and functions for I/O and data processing taking after the Wiring (Arduino) language. This code began as part of the Hackable Instruments project (EPSRC) at Queen Mary University of London, 2013-14.

(c) 2014-15 Andrew McPherson, Victor Zappi and Giulio Moro, Queen Mary University of London