changeset 301:e4392164b458 prerelease

RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 14:34:41 +0100
parents dbeed520b014
children b26e7c61e3b6
files .project Doxyfile Makefile core/Midi.cpp core/NetworkSend.cpp core/OSCClient.cpp core/OSCServer.cpp core/PRU.cpp core/PulseIn.cpp core/RTAudio.cpp core/RTAudioCommandLine.cpp core/ReceiveAudioThread.cpp core/Scope.cpp core/WriteFile.cpp core/default_main.cpp examples/7segment/render.cpp examples/airharp/render.cpp examples/analogDigitalDemo/main.cpp examples/analogDigitalDemo/render.cpp examples/audio_in_FFT/main.cpp examples/audio_in_FFT/render.cpp examples/basic/main.cpp examples/basic/render.cpp examples/basic_FFT_phase_vocoder/main.cpp examples/basic_FFT_phase_vocoder/render.cpp examples/basic_analog_input/main.cpp examples/basic_analog_input/render.cpp examples/basic_analog_output/main.cpp examples/basic_analog_output/render.cpp examples/basic_blink/render.cpp examples/basic_button/render.cpp examples/basic_libpd/main.cpp examples/basic_libpd/render.cpp examples/basic_midi/render.cpp examples/basic_network/main.cpp examples/basic_network/render.cpp examples/basic_passthru/main.cpp examples/basic_passthru/render.cpp examples/basic_pulseIn/render.cpp examples/basic_writeFile/main.cpp examples/basic_writeFile/render.cpp examples/bucket_brigade_chorus/render.cpp examples/cape_test/main.cpp examples/cape_test/render.cpp examples/d-box/how_to_build_dbox.txt examples/d-box/main.cpp examples/d-box/render.cpp examples/filter_FIR/main.cpp examples/filter_FIR/render.cpp examples/filter_IIR/main.cpp examples/filter_IIR/render.cpp examples/gpioAnalogLoopbackTest/render.cpp examples/level_meter/render.cpp examples/loggingSensors/main.cpp examples/loggingSensors/render.cpp examples/measure_noisefloor/main.cpp examples/measure_noisefloor/render.cpp examples/mpr121/render.cpp examples/osc/render.cpp examples/oscillator_bank/main.cpp examples/oscillator_bank/render.cpp examples/samples/main.cpp examples/samples/render.cpp examples/scope_analogue/render.cpp examples/scope_basic/render.cpp examples/stepper/render.cpp examples/tank_wars/main.cpp examples/tank_wars/render.cpp include/BeagleRT.h include/Bela.h include/Midi.h include/NetworkSend.h include/OSCClient.h include/OSCServer.h include/PRU.h include/PulseIn.h include/ReceiveAudioThread.h include/Utilities.h include/WriteFile.h resources/network/network_readme.txt
diffstat 80 files changed, 1090 insertions(+), 1090 deletions(-) [+]
line wrap: on
line diff
--- a/.project	Fri May 27 13:58:20 2016 +0100
+++ b/.project	Fri May 27 14:34:41 2016 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>BeagleRT</name>
+	<name>Bela</name>
 	<comment></comment>
 	<projects>
 	</projects>
--- a/Doxyfile	Fri May 27 13:58:20 2016 +0100
+++ b/Doxyfile	Fri May 27 14:34:41 2016 +0100
@@ -26,7 +26,7 @@
 # identify the project. Note that if you do not use Doxywizard you need
 # to put quotes around the project name if it contains spaces.
 
-PROJECT_NAME           = "BeagleRT"
+PROJECT_NAME           = "Bela"
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
 # This could be handy for archiving the generated documentation or
@@ -648,7 +648,7 @@
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  =	include/BeagleRT.h include/Utilities.h include/digital_gpio_mapping.h include/PulseIn.h include/Scope.h include/Midi.h include/UdpClient.h include/WriteFile.h 
+INPUT                  =	include/Bela.h include/Utilities.h include/digital_gpio_mapping.h include/PulseIn.h include/Scope.h include/Midi.h include/UdpClient.h include/WriteFile.h 
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
--- a/Makefile	Fri May 27 13:58:20 2016 +0100
+++ b/Makefile	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-# BeagleRT
+# Bela
 # Low-latency, real-time audio and sensor processing on BeagleBone Black
 # (c) 2016 Andrew McPherson, Victor Zappi, Giulio Moro, Liam Donovan
 # Centre for Digital Music, Queen Mary University of London
@@ -81,7 +81,7 @@
 CPP_OBJS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.o)))
 CPP_DEPS := $(addprefix $(PROJECT_DIR)/build/,$(notdir $(CPP_SRCS:.cpp=.d)))
 
-# Core BeagleRT sources
+# Core Bela sources
 CORE_CPP_SRCS = $(filter-out core/default_main.cpp, $(wildcard core/*.cpp))
 CORE_OBJS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.o)))
 CORE_CPP_DEPS := $(addprefix build/core/,$(notdir $(CORE_CPP_SRCS:.cpp=.d)))
@@ -92,11 +92,11 @@
 DEFAULT_MAIN_OBJS := ./build/core/default_main.o
 DEFAULT_MAIN_CPP_DEPS := ./build/core/default_main.d
 
-# all = build BeagleRT 
+# all = build Bela 
 all: SYNTAX_FLAG :=
-all: BeagleRT
+all: Bela
 
-# debug = buildBeagleRT debug
+# debug = buildBela debug
 debug: CPP_FLAGS=-g
 debug: C_FLAGS=-g
 debug: all
@@ -105,7 +105,7 @@
 syntax: SYNTAX_FLAG := -fsyntax-only
 syntax: SYNTAX
 
-# Rule for BeagleRT core C++ files
+# Rule for Bela core C++ files
 build/core/%.o: ./core/%.cpp
 	@echo 'Building $(notdir $<)...'
 #	@echo 'Invoking: C++ Compiler'
@@ -142,7 +142,7 @@
 # function, and conditionally call one of two recursive make targets depending on whether
 # we want to link in the default main file or not. The kludge is the mess of a shell script
 # line below. Surely there's a better way to do this?
-BeagleRT: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS)
+Bela: $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS)
 	$(eval DEFAULT_MAIN_CONDITIONAL := $(shell bash -c 'if [ `nm $(PROJECT_DIR)/build/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "$(DEFAULT_MAIN_OBJS)"; else echo ""; fi'))
 	@echo 'Invoking: C++ linker'
 	@$(CXX) $(SYNTAX_FLAG) -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "$(PROJECT_DIR)/$(PROJECT)" $(CORE_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS)
@@ -157,13 +157,13 @@
 	-$(RM) $(PROJECT_DIR)/build/* $(PROJECT_DIR)/$(PROJECT)
 	-@echo ' '	
 
-# Remove all the built objects, including the core BeagleRT objects
+# Remove all the built objects, including the core Bela objects
 distclean:
-	-$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) BeagleRT
+	-$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela
 	-@echo ' '
 OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)"
 
-$(OUTPUT_FILE): BeagleRT
+$(OUTPUT_FILE): Bela
 run: $(OUTPUT_FILE)
 	@echo "Running $(OUTPUT_FILE)"
 	@$(OUTPUT_FILE)
@@ -171,7 +171,7 @@
 	
 # Remove only the user-generated objects
 #clean:
-#	-$(RM) build/source/* BeagleRT
+#	-$(RM) build/source/* Bela
 #	-@echo ' '
 
 post-build:
--- a/core/Midi.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/Midi.cpp	Fri May 27 14:34:41 2016 +0100
@@ -92,8 +92,8 @@
 
 void Midi::staticConstructor(){
 	staticConstructed = true;
-	midiInputTask = BeagleRT_createAuxiliaryTask(Midi::midiInputLoop, 50, "MidiInput");
-	midiOutputTask = BeagleRT_createAuxiliaryTask(Midi::midiOutputLoop, 50, "MidiOutupt");
+	midiInputTask = Bela_createAuxiliaryTask(Midi::midiInputLoop, 50, "MidiInput");
+	midiOutputTask = Bela_createAuxiliaryTask(Midi::midiOutputLoop, 50, "MidiOutupt");
 }
 
 Midi::~Midi(){}
@@ -176,7 +176,7 @@
 		return -1;
 	} else {
 		printf("Reading from Midi port %d\n", port);
-		BeagleRT_scheduleAuxiliaryTask(midiInputTask);
+		Bela_scheduleAuxiliaryTask(midiInputTask);
 		return 1;
 	}
 }
@@ -188,7 +188,7 @@
 		return -1;
 	} else {
 		printf("Writing to Midi port %d\n", port);
-		BeagleRT_scheduleAuxiliaryTask(midiOutputTask);
+		Bela_scheduleAuxiliaryTask(midiOutputTask);
 		return 1;
 	}
 }
--- a/core/NetworkSend.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/NetworkSend.cpp	Fri May 27 14:34:41 2016 +0100
@@ -19,7 +19,7 @@
 	staticConstructed=true;
 	threadIsExiting=false;
 	threadRunning=false;
-	sendDataTask = BeagleRT_createAuxiliaryTask(::sendData, 95, "sendDataTask"); //TODO: allow variable priority
+	sendDataTask = Bela_createAuxiliaryTask(::sendData, 95, "sendDataTask"); //TODO: allow variable priority
 }
 void NetworkSend::sendAllData(){
 	for(unsigned int n=0; n<NetworkSend::objAddrs.size(); n++){
@@ -30,7 +30,7 @@
 	return objAddrs.size();
 }
 void NetworkSend::startThread(){
-	BeagleRT_scheduleAuxiliaryTask(sendDataTask);
+	Bela_scheduleAuxiliaryTask(sendDataTask);
 }
 void NetworkSend::stopThread(){
 	threadIsExiting=true;
@@ -95,7 +95,7 @@
 #ifdef USE_JUCE
 #else
 	staticConstructor(); //FIXME: ideally this should be in the constructor, but this is not currently possible
-						//because of limitations in BeagleRT_createAuxiliaryTask()
+						//because of limitations in Bela_createAuxiliaryTask()
 	//keep track of added active instances
 	objAddrs.push_back(this);//TODO: this line should be in the constructor, but something weird happens if
 	// an instance of NetworkSend is then declared globally: the constructor gets called,
--- a/core/OSCClient.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/OSCClient.cpp	Fri May 27 14:34:41 2016 +0100
@@ -22,7 +22,7 @@
 void OSCClient::createAuxTasks(){
     char name [30];
     sprintf (name, "OSCSendTask %i", port);
-    OSCSendTask = BeagleRT_createAuxiliaryTask(sendQueue, BEAGLERT_AUDIO_PRIORITY-5, name, this, true);
+    OSCSendTask = Bela_createAuxiliaryTask(sendQueue, BEAGLERT_AUDIO_PRIORITY-5, name, this, true);
 }
 
 void OSCClient::queueMessage(oscpkt::Message msg){
@@ -76,4 +76,4 @@
 }
 oscpkt::Message OSCMessageFactory::end(){
     return msg;
-}
\ No newline at end of file
+}
--- a/core/OSCServer.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/OSCServer.cpp	Fri May 27 14:34:41 2016 +0100
@@ -21,7 +21,7 @@
 void OSCServer::createAuxTasks(){
     char name [30];
     sprintf (name, "OSCRecieveTask %i", port);
-    OSCRecieveTask = BeagleRT_createAuxiliaryTask(OSCServer::checkMessages, BEAGLERT_AUDIO_PRIORITY-5, name, this, true);
+    OSCRecieveTask = Bela_createAuxiliaryTask(OSCServer::checkMessages, BEAGLERT_AUDIO_PRIORITY-5, name, this, true);
 }
 
 void OSCServer::messageCheck(){
--- a/core/PRU.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/PRU.cpp	Fri May 27 14:34:41 2016 +0100
@@ -18,7 +18,7 @@
 #include "../include/pruss_intc_mapping.h"
 #include "../include/digital_gpio_mapping.h"
 #include "../include/GPIOcontrol.h"
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 #include "../include/pru_rtaudio_bin.h"
 
 #include <iostream>
@@ -110,7 +110,7 @@
 extern int gRTAudioVerbose;
 
 // Constructor: specify a PRU number (0 or 1)
-PRU::PRU(BeagleRTContext *input_context)
+PRU::PRU(BelaContext *input_context)
 : context(input_context), pru_number(0), running(false), analog_enabled(false),
   digital_enabled(false), gpio_enabled(false), led_enabled(false),
   gpio_test_pin_enabled(false),
@@ -662,7 +662,7 @@
 			xenomai_gpio[GPIO_CLEARDATAOUT] = TEST_PIN_MASK;
 		}
 		
-		BeagleRT_autoScheduleAuxiliaryTasks();
+		Bela_autoScheduleAuxiliaryTasks();
 
 		// FIXME: TESTING!!
 		// if(testCount > 100000)
--- a/core/PulseIn.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/PulseIn.cpp	Fri May 27 14:34:41 2016 +0100
@@ -7,7 +7,7 @@
 
 #include "../include/PulseIn.h"
 
-void PulseIn::init(BeagleRTContext* context, unsigned int digitalInput, int direction){
+void PulseIn::init(BelaContext* context, unsigned int digitalInput, int direction){
 	_digitalInput = digitalInput;
 	_pulseIsOn = false;
 	_pulseOnState = direction == 1 ? 1 : 0;
@@ -16,7 +16,7 @@
 	pinModeFrame(context, 0, digitalInput, INPUT); //context is used to allocate the number of elements in the array
 }
 
-void PulseIn::check(BeagleRTContext* context){
+void PulseIn::check(BelaContext* context){
 	if(_digitalInput == -1){ //must be init'ed before calling check();
 		throw(1);
 	}
--- a/core/RTAudio.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/RTAudio.cpp	Fri May 27 14:34:41 2016 +0100
@@ -27,7 +27,7 @@
 #include <native/intr.h>
 #include <rtdk.h>
 
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 #include "../include/PRU.h"
 #include "../include/I2c_Codec.h"
 #include "../include/GPIOcontrol.h"
@@ -77,7 +77,7 @@
 int gAmplifierShouldBeginMuted = 0;
 
 // Context which holds all the audio/sensor data passed to the render routines
-BeagleRTContext gContext;
+BelaContext gContext;
 
 // User data passed in from main()
 void *gUserData;
@@ -96,7 +96,7 @@
 //
 // Returns 0 on success.
 
-int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData)
+int Bela_initAudio(BelaInitSettings *settings, void *userData)
 {
 	// Sanity checks
 	if(settings->pruNumber < 0 || settings->pruNumber > 1) {
@@ -110,12 +110,12 @@
 	
 	rt_print_auto_init(1);
 
-	BeagleRT_setVerboseLevel(settings->verbose);
+	Bela_setVerboseLevel(settings->verbose);
 	strncpy(gPRUFilename, settings->pruFilename, MAX_PRU_FILENAME_LENGTH);
 	gUserData = userData;
 
 	// Initialise context data structure
-	memset(&gContext, 0, sizeof(BeagleRTContext));
+	memset(&gContext, 0, sizeof(BelaContext));
 
 	if(gRTAudioVerbose) {
 		cout << "Starting with period size " << settings->periodSize << "; ";
@@ -231,17 +231,17 @@
 	}
 
 	// Set default volume levels
-	BeagleRT_setDACLevel(settings->dacLevel);
-	BeagleRT_setADCLevel(settings->adcLevel);
+	Bela_setDACLevel(settings->dacLevel);
+	Bela_setADCLevel(settings->adcLevel);
 	// TODO: add more argument checks
 	for(int n = 0; n < 2; n++){
 		if(settings->pgaGain[n] > 59.5){
 			std::cerr << "PGA gain out of range [0,59.5]\n";
 			exit(1);
 		}
-		BeagleRT_setPgaGain(settings->pgaGain[n], n);
+		Bela_setPgaGain(settings->pgaGain[n], n);
 	}
-	BeagleRT_setHeadphoneLevel(settings->headphoneLevel);
+	Bela_setHeadphoneLevel(settings->headphoneLevel);
 
 	// Call the user-defined initialisation function
 	if(!setup(&gContext, userData)) {
@@ -279,7 +279,7 @@
 
 			if(!gAmplifierShouldBeginMuted) {
 				// First unmute the amplifier
-				if(BeagleRT_muteSpeakers(0)) {
+				if(Bela_muteSpeakers(0)) {
 					if(gRTAudioVerbose)
 						rt_printf("Warning: couldn't set value (high) on amplifier mute pin\n");
 				}
@@ -306,7 +306,7 @@
 // (equal or lower) priority. Audio priority is defined in BEAGLERT_AUDIO_PRIORITY;
 // priority should be generally be less than this.
 // Returns an (opaque) pointer to the created task on success; 0 on failure
-AuxiliaryTask BeagleRT_createAuxiliaryTask(void (*functionToCall)(void* args), int priority, const char *name, void* args, bool autoSchedule)
+AuxiliaryTask Bela_createAuxiliaryTask(void (*functionToCall)(void* args), int priority, const char *name, void* args, bool autoSchedule)
 {
 	InternalAuxiliaryTask *newTask = (InternalAuxiliaryTask*)malloc(sizeof(InternalAuxiliaryTask));
 
@@ -330,7 +330,7 @@
 
 	return (AuxiliaryTask)newTask;
 }
-AuxiliaryTask BeagleRT_createAuxiliaryTask(void (*functionToCall)(void), int priority, const char *name, bool autoSchedule)
+AuxiliaryTask Bela_createAuxiliaryTask(void (*functionToCall)(void), int priority, const char *name, bool autoSchedule)
 {
         InternalAuxiliaryTask *newTask = (InternalAuxiliaryTask*)malloc(sizeof(InternalAuxiliaryTask));
         
@@ -356,20 +356,20 @@
 
 // Schedule a previously created (and started) auxiliary task. It will run when the priority rules next
 // allow it to be scheduled.
-void BeagleRT_scheduleAuxiliaryTask(AuxiliaryTask task)
+void Bela_scheduleAuxiliaryTask(AuxiliaryTask task)
 {
 	InternalAuxiliaryTask *taskToSchedule = (InternalAuxiliaryTask *)task;
 	if(taskToSchedule->started == false){ // Note: this is not the safest method to check if a task
-		BeagleRT_startAuxiliaryTask(task); // is started (or ready to be resumed), but it probably is the fastest.
+		Bela_startAuxiliaryTask(task); // is started (or ready to be resumed), but it probably is the fastest.
                                            // A safer approach would use rt_task_inquire()
 	}
 	rt_task_resume(&taskToSchedule->task);
 }
-void BeagleRT_autoScheduleAuxiliaryTasks(){
+void Bela_autoScheduleAuxiliaryTasks(){
     vector<InternalAuxiliaryTask*>::iterator it;
 	for(it = getAuxTasks().begin(); it != getAuxTasks().end(); it++) {
 	    if ((InternalAuxiliaryTask *)(*it)->autoSchedule){
-    		BeagleRT_scheduleAuxiliaryTask(*it);
+    		Bela_scheduleAuxiliaryTask(*it);
 	    }
 	}
 }
@@ -407,7 +407,7 @@
 }
 
 
-int BeagleRT_startAuxiliaryTask(AuxiliaryTask task){
+int Bela_startAuxiliaryTask(AuxiliaryTask task){
 	InternalAuxiliaryTask *taskStruct;
 	taskStruct = (InternalAuxiliaryTask *)task;
 	if(taskStruct->started == true)
@@ -424,7 +424,7 @@
 // It launches the real-time Xenomai task which runs the audio loop. Returns 0
 // on success.
 
-int BeagleRT_startAudio()
+int Bela_startAudio()
 {
 	// Create audio thread with high Xenomai priority
 	if(rt_task_create(&gRTAudioThread, gRTAudioThreadName, 0, BEAGLERT_AUDIO_PRIORITY, T_JOINABLE | T_FPU)) {
@@ -450,7 +450,7 @@
 	// The user may have created other tasks. Start those also.
 	vector<InternalAuxiliaryTask*>::iterator it;
 	for(it = getAuxTasks().begin(); it != getAuxTasks().end(); it++) {
-		int ret = BeagleRT_startAuxiliaryTask(*it);
+		int ret = Bela_startAuxiliaryTask(*it);
 		if(ret != 0)
 			return -2;
 	}
@@ -460,7 +460,7 @@
 // Stop the PRU-based audio from running and wait
 // for the tasks to complete before returning.
 
-void BeagleRT_stopAudio()
+void Bela_stopAudio()
 {
 	// Tell audio thread to stop (if this hasn't been done already)
 	gShouldStop = true;
@@ -483,7 +483,7 @@
 }
 
 // Free any resources associated with PRU real-time audio
-void BeagleRT_cleanupAudio()
+void Bela_cleanupAudio()
 {
 	cleanup(&gContext, gUserData);
 
@@ -519,7 +519,7 @@
 
 // Set the level of the DAC; affects all outputs (headphone, line, speaker)
 // 0dB is the maximum, -63.5dB is the minimum; 0.5dB steps
-int BeagleRT_setDACLevel(float decibels)
+int Bela_setDACLevel(float decibels)
 {
 	if(gAudioCodec == 0)
 		return -1;
@@ -528,7 +528,7 @@
 
 // Set the level of the ADC
 // 0dB is the maximum, -12dB is the minimum; 1.5dB steps
-int BeagleRT_setADCLevel(float decibels)
+int Bela_setADCLevel(float decibels)
 {
 	if(gAudioCodec == 0)
 		return -1;
@@ -537,7 +537,7 @@
 
 // Set the level of the Programmable Gain Amplifier
 // 59.5dB is maximum, 0dB is minimum; 0.5dB steps
-int BeagleRT_setPgaGain(float decibels, int channel){
+int Bela_setPgaGain(float decibels, int channel){
 	if(gAudioCodec == 0)
 		return -1;
 	return gAudioCodec->setPga(decibels, channel);
@@ -546,7 +546,7 @@
 // Set the level of the onboard headphone amplifier; affects headphone
 // output only (not line out or speaker)
 // 0dB is the maximum, -63.5dB is the minimum; 0.5dB steps
-int BeagleRT_setHeadphoneLevel(float decibels)
+int Bela_setHeadphoneLevel(float decibels)
 {
 	if(gAudioCodec == 0)
 		return -1;
@@ -556,7 +556,7 @@
 // Mute or unmute the onboard speaker amplifiers
 // mute == 0 means unmute; otherwise mute
 // Returns 0 on success
-int BeagleRT_muteSpeakers(int mute)
+int Bela_muteSpeakers(int mute)
 {
 	int pinValue = mute ? LOW : HIGH;
 
@@ -568,7 +568,7 @@
 }
 
 // Set the verbosity level
-void BeagleRT_setVerboseLevel(int level)
+void Bela_setVerboseLevel(int level)
 {
 	gRTAudioVerbose = level;
 }
--- a/core/RTAudioCommandLine.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/RTAudioCommandLine.cpp	Fri May 27 14:34:41 2016 +0100
@@ -9,7 +9,7 @@
 #include <cstdlib>
 #include <cstring>
 #include <getopt.h>
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 
 #define OPT_PRU_FILE 1000
 #define OPT_PGA_GAIN_LEFT 1001
@@ -46,8 +46,8 @@
 
 const char gDefaultShortOptions[] = "p:vN:M:C:D:A:H:G:B:R:T:S:";
 
-// This function sets the default settings for the BeagleRTInitSettings structure
-void BeagleRT_defaultSettings(BeagleRTInitSettings *settings)
+// This function sets the default settings for the BelaInitSettings structure
+void Bela_defaultSettings(BelaInitSettings *settings)
 {
 	// Set default values for settings
 	settings->periodSize = 16;
@@ -87,7 +87,7 @@
 // be stored in settings, otherwise arguments will be returned
 // as getopt() normally does.
 
-int BeagleRT_getopt_long(int argc, char *argv[], const char *customShortOptions, const struct option *customLongOptions, BeagleRTInitSettings *settings)
+int Bela_getopt_long(int argc, char *argv[], const char *customShortOptions, const struct option *customLongOptions, BelaInitSettings *settings)
 {
 	static int firstRun = 1;
 	static char totalShortOptions[256];
@@ -244,7 +244,7 @@
 
 // This function prints standard usage information for default arguments
 // Call from within your own usage function
-void BeagleRT_usage()
+void Bela_usage()
 {
 	std::cerr << "   --period [-p] period:            Set the hardware period (buffer) size in analog samples\n";
 	std::cerr << "   --dac-level [-D] dBs:            Set the DAC output level (0dB max; -63.5dB min)\n";
--- a/core/ReceiveAudioThread.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/ReceiveAudioThread.cpp	Fri May 27 14:34:41 2016 +0100
@@ -18,7 +18,7 @@
 		return;
 	staticConstructed=true;
     threadIsExiting=false;
-	receiveDataTask=BeagleRT_createAuxiliaryTask(receiveData, 90, "receiveDataTask"); //TODO: allow different priorities
+	receiveDataTask=Bela_createAuxiliaryTask(receiveData, 90, "receiveDataTask"); //TODO: allow different priorities
 }
 #endif /* USE_JUCE */
 
@@ -249,7 +249,7 @@
 #ifdef USE_JUCE
 #else
 void ReceiveAudioThread::startThread(){
-	BeagleRT_scheduleAuxiliaryTask(receiveDataTask);
+	Bela_scheduleAuxiliaryTask(receiveDataTask);
 }
 void ReceiveAudioThread::stopThread(){
 	threadIsExiting=true;
@@ -272,7 +272,7 @@
 	int count=0;
 	// Clean the socket from anything that is currently in it.
 #ifdef USE_JUCE
-	// this is borrowed from BeagleRT's UdpServer class.
+	// this is borrowed from Bela's UdpServer class.
 	int n;
 	do {
 		float waste;
--- a/core/Scope.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/Scope.cpp	Fri May 27 14:34:41 2016 +0100
@@ -31,8 +31,8 @@
 	socket.setPort(SCOPE_UDP_PORT);
 
 	// setup the auxiliary tasks
-	scopeTriggerTask = BeagleRT_createAuxiliaryTask(Scope::triggerTask, BEAGLERT_AUDIO_PRIORITY-2, "scopeTriggerTask", this, true);
-	scopeSendBufferTask = BeagleRT_createAuxiliaryTask(Scope::sendBufferTask, BEAGLERT_AUDIO_PRIORITY-1, "scopeSendBufferTask", this);
+	scopeTriggerTask = Bela_createAuxiliaryTask(Scope::triggerTask, BEAGLERT_AUDIO_PRIORITY-2, "scopeTriggerTask", this, true);
+	scopeSendBufferTask = Bela_createAuxiliaryTask(Scope::sendBufferTask, BEAGLERT_AUDIO_PRIORITY-1, "scopeSendBufferTask", this);
 
     // send an OSC message to address /scope-setup
     // then wait 1 second for a reply on /scope-setup-reply 
@@ -140,7 +140,7 @@
 }
 
 void Scope::scheduleSendBufferTask(){
-    BeagleRT_scheduleAuxiliaryTask(scopeSendBufferTask);
+    Bela_scheduleAuxiliaryTask(scopeSendBufferTask);
 }
 
 bool Scope::triggered(){
--- a/core/WriteFile.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/WriteFile.cpp	Fri May 27 14:34:41 2016 +0100
@@ -20,7 +20,7 @@
 	staticConstructed=true;
 	threadIsExiting=false;
 	threadRunning=false;
-	writeAllFilesTask = BeagleRT_createAuxiliaryTask(WriteFile::run, 60, "writeAllFilesTask");
+	writeAllFilesTask = Bela_createAuxiliaryTask(WriteFile::run, 60, "writeAllFilesTask");
 }
 
 WriteFile::WriteFile(){
@@ -45,7 +45,7 @@
 	stringBuffer = (char*)malloc(sizeof(char) * (stringBufferLength));
 	setHeader("variable=[\n");
 	setFooter("];\n");
-	staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in BeagleRT
+	staticConstructor(); //TODO: this line should be in the constructor, but cannot be because of a bug in Bela
 	objAddrs.push_back(this);
 	echoedLines = 0;
 	echoPeriod = 1;
@@ -170,7 +170,7 @@
 }
 
 void WriteFile::startThread(){
-	BeagleRT_scheduleAuxiliaryTask(writeAllFilesTask);
+	Bela_scheduleAuxiliaryTask(writeAllFilesTask);
 }
 
 void WriteFile::stopThread(){
--- a/core/default_main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/core/default_main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 
 using namespace std;
 
@@ -25,14 +25,14 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --help [-h]:                Print this menu\n";
 }
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -41,12 +41,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -60,13 +60,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -81,10 +81,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/7segment/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/7segment/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 
 #define NUM_PINS 12
@@ -48,7 +48,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {	
 	// This project makes the assumption that the audio and digital
 	// sample rates are the same. But check it to be sure!
@@ -69,7 +69,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		// Check for rotation between digits
@@ -121,7 +121,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	
 }
--- a/examples/airharp/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/airharp/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -13,7 +13,7 @@
 #include "String.h"
 #include "Plectrum.h"
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include <stdio.h>
 #include <cstdlib>
@@ -69,7 +69,7 @@
 float y2_r = 0;
 
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 
 	gInverseSampleRate = 1.0 / context->audioSampleRate;
@@ -94,7 +94,7 @@
 	return true;
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 
 	float lastAccel = 0;
@@ -206,7 +206,7 @@
 // cleanup_render() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in initialise_render().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/analogDigitalDemo/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/analogDigitalDemo/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -33,14 +33,14 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --help [-h]:                Print this menu\n";
 }
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 1000.0;	// Frequency of crossover
 
 	struct option customOptions[] =
@@ -51,12 +51,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -77,13 +77,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -98,10 +98,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/analogDigitalDemo/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/analogDigitalDemo/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -4,7 +4,7 @@
  * Queen Mary, University of London
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 #include <rtdk.h>
@@ -18,7 +18,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	return true;
 }
@@ -28,7 +28,7 @@
 // ADCs and DACs (if available). If only audio is available, numAnalogFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 /*
 we assume that gNumAnalogChannels=8, numAnalogFrames==8 and  numDigitalFrames==numAudioFrames
  * */
@@ -88,7 +88,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	// Nothing to do here
 }
--- a/examples/audio_in_FFT/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/audio_in_FFT/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --fftsize [-s] size:     Set the fSize of the FFT, in samples\n";
 	cerr << "   --help [-h]:             Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	int fftSize = 64;		    // Size of the FFT, in samples
 
 	struct option customOptions[] =
@@ -44,14 +44,14 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 //	settings.useAnalog = 0;	// No matrix usage by default
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hs:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hs:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -68,13 +68,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &fftSize) != 0) {
+	if(Bela_initAudio(&settings, &fftSize) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -89,10 +89,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/audio_in_FFT/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/audio_in_FFT/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <rtdk.h>
 #include <NE10.h>					// neon library
 #include <cmath>
@@ -32,7 +32,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	// Retrieve a parameter passed in from the initAudio() call
 	gFFTSize = *(int *)userData;
@@ -53,7 +53,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		timeDomainIn[gReadPointer].r = (ne10_float32_t) ((context->audioIn[n*context->audioChannels] +
@@ -83,7 +83,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	NE10_FREE(timeDomainIn);
 	NE10_FREE(timeDomainOut);
--- a/examples/basic/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the oscillator\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 440.0;	// Frequency of oscillator
 
 	struct option customOptions[] =
@@ -44,12 +44,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -66,13 +66,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -87,10 +87,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include <Utilities.h>
 
@@ -23,7 +23,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	// Retrieve a parameter passed in from the initAudio() call
 	if(userData != 0)
@@ -40,7 +40,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		float out = 0.8f * sinf(gPhase);
@@ -63,7 +63,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_FFT_phase_vocoder/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_FFT_phase_vocoder/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -15,7 +15,7 @@
 #include <sys/time.h>
 #include <sndfile.h>				// to load audio files
 #include "SampleData.h"
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -86,7 +86,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --help [-h]:                Print this menu\n";
 }
@@ -105,7 +105,7 @@
 extern SampleData gSampleData;
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	struct timeval tv;
 	string fileName;			// Name of the sample to load
 
@@ -120,14 +120,14 @@
 	gSampleData.sampleLen = -1;
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	settings.periodSize = 32; // Larger period size by default, for testing
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -160,7 +160,7 @@
 
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &gSampleData) != 0) {
+	if(Bela_initAudio(&settings, &gSampleData) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
@@ -171,7 +171,7 @@
 	gFirstMicroseconds = tv.tv_usec;
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -186,10 +186,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_FFT_phase_vocoder/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_FFT_phase_vocoder/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <rtdk.h>
 #include <NE10.h>					// NEON FFT library
 #include <cmath>
@@ -100,7 +100,7 @@
 // in from the call to initAudio().
 //
 // Return true on success; returning false halts the program.
-bool setup(BeagleRTContext* context, void* userData)
+bool setup(BelaContext* context, void* userData)
 {
 	midi.readFrom(0);
 	midi.setParserCallback(midiCallback);
@@ -129,7 +129,7 @@
 	}
 
 	// Initialise auxiliary tasks
-	if((gFFTTask = BeagleRT_createAuxiliaryTask(&process_fft_background, 90, "fft-calculation")) == 0)
+	if((gFFTTask = Bela_createAuxiliaryTask(&process_fft_background, 90, "fft-calculation")) == 0)
 		return false;
 	rt_printf("You are listening to an FFT phase-vocoder with overlap-and-add.\n"
 	"Use Midi Control Change to control:\n"
@@ -204,7 +204,7 @@
 // Input and output are given from the audio hardware and the other
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
-void render(BeagleRTContext* context, void* userData)
+void render(BelaContext* context, void* userData)
 {
 	float* audioIn = context->audioIn;
 	float* audioOut = context->audioOut;
@@ -250,7 +250,7 @@
 			//process_fft(gInputBuffer, gInputBufferPointer, gOutputBuffer, gOutputBufferPointer);
 			gFFTInputBufferPointer = gInputBufferPointer;
 			gFFTOutputBufferPointer = gOutputBufferWritePointer;
-			BeagleRT_scheduleAuxiliaryTask(gFFTTask);
+			Bela_scheduleAuxiliaryTask(gFFTTask);
 
 			gSampleCount = 0;
 		}
@@ -261,7 +261,7 @@
 // cleanup_render() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in initialise_render().
 
-void cleanup(BeagleRTContext* context, void* userData)
+void cleanup(BelaContext* context, void* userData)
 {
 	NE10_FREE(timeDomainIn);
 	NE10_FREE(timeDomainOut);
--- a/examples/basic_analog_input/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_analog_input/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -28,7 +28,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] input:  Choose the analog input controlling frequency (0-7; default 0)\n";
 	cerr << "   --amplitude [-a] input:  Choose the analog input controlling amplitude (0-7; default 1)\n";
@@ -37,7 +37,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -48,12 +48,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:a:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:a:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -81,7 +81,7 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
@@ -92,7 +92,7 @@
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -107,10 +107,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_analog_input/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_analog_input/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <rtdk.h>
 #include <cmath>
@@ -31,7 +31,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	if(context->analogFrames == 0 || context->analogFrames > context->audioFrames) {
 		rt_printf("Error: this example needs analog enabled, with 4 or 8 channels\n");
@@ -50,7 +50,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	float frequency = 440.0;
 	float amplitude = 0.8;
@@ -79,7 +79,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_analog_output/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_analog_output/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the LED fade (default: 1.0)\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 1.0;	// Frequency of LED fades
 
 	struct option customOptions[] =
@@ -44,7 +44,7 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// In this example, audio isn't used so might as well leave speaker muted
 	settings.beginMuted = 1;
@@ -52,7 +52,7 @@
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -73,13 +73,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -94,10 +94,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_analog_output/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_analog_output/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <rtdk.h>
 #include <cmath>
@@ -28,7 +28,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	// Retrieve a parameter passed in from the initAudio() call
 	gFrequency = *(float *)userData;
@@ -49,7 +49,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->analogFrames; n++) {
 		// Set LED to different phase for each matrix channel
@@ -72,7 +72,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_blink/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_blink/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 #include <rtdk.h>
@@ -12,7 +12,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
     pinModeFrame(context, 0, P8_07, OUTPUT);
 	return true;
@@ -28,7 +28,7 @@
 * The LED will blink every @interval seconds.
 */
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
   static int count=0; //counts elapsed samples
   float interval=0.5; //how often to toggle the LED (in seconds)
@@ -53,7 +53,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	// Nothing to do here
 }
--- a/examples/basic_button/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_button/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -4,7 +4,7 @@
  * Queen Mary, University of London
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 #include <rtdk.h>
@@ -19,7 +19,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	pinModeFrame(context, 0, P8_08, INPUT);
 	pinModeFrame(context, 0, P8_07, OUTPUT);
@@ -39,7 +39,7 @@
 * The program will read the button and make the LED blink when the button is pressed.
 */
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n=0; n<context->digitalFrames; n++){
 		int status=digitalReadFrame(context, 0, P8_08); //read the value of the button
@@ -54,7 +54,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	// Nothing to do here
 }
--- a/examples/basic_libpd/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_libpd/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 
 using namespace std;
 
@@ -25,14 +25,14 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --help [-h]:                Print this menu\n";
 }
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -41,12 +41,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -60,13 +60,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -81,10 +81,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_libpd/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_libpd/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
  *      Author: parallels
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include <Utilities.h>
 #include <I2c_Codec.h>
@@ -34,7 +34,7 @@
   printf("noteon: %d %d %d\n", ch, pitch, vel);
 }
 
-void BeagleRT_printHook(const char *recv){
+void Bela_printHook(const char *recv){
 	rt_printf("%s", recv);
 }
 
@@ -49,7 +49,7 @@
 }
 
 AuxiliaryTask  udpReadTask;
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	gChannelsInUse = min((int)(context->analogChannels+context->audioChannels), (int)gChannelsInUse);
 	udpServer.bindToPort(1234);
@@ -70,7 +70,7 @@
 //	}
 	//following lines borrowed from libpd/samples/c/pdtest/pdtest.c
 	// init pd
-	libpd_set_printhook(BeagleRT_printHook); // set this before calling libpd_init
+	libpd_set_printhook(Bela_printHook); // set this before calling libpd_init
 	libpd_set_noteonhook(pdnoteon);
 	libpd_init();
 	//TODO: analyse the ASCII of the patch file and find the in/outs to use
@@ -91,8 +91,8 @@
 	// open patch       [; pd open file folder(
 	libpd_openfile(file, folder);
     
-	udpReadTask = BeagleRT_createAuxiliaryTask(udpRead, 60, "udpReadTask");
-	BeagleRT_scheduleAuxiliaryTask(udpReadTask);
+	udpReadTask = Bela_createAuxiliaryTask(udpRead, 60, "udpReadTask");
+	Bela_scheduleAuxiliaryTask(udpReadTask);
 	return true;
 }
 
@@ -100,8 +100,8 @@
 // Input and output are given from the audio hardware and the other
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
-BeagleRTContext *c;
-void render(BeagleRTContext *context, void *userData)
+BelaContext *c;
+void render(BelaContext *context, void *userData)
 {
 	static int inW = 0;
 	static int outR = 0;
@@ -180,7 +180,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	free(gInBuf);
 	free(gOutBuf);
--- a/examples/basic_midi/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_midi/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
  *      Author: parallels
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Midi.h>
 #include <Utilities.h>
 #include <stdlib.h>
@@ -41,7 +41,7 @@
 // Return true on success; returning false halts the program.
 Midi midi;
 int gMidiPort0 = 0;
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	midi.readFrom(gMidiPort0);
 	midi.writeTo(gMidiPort0);
@@ -62,7 +62,7 @@
 
 
 enum {kVelocity, kNoteOn, kNoteNumber};
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 // one way of getting the midi data is to parse them yourself
 //	(you should set midi.enableParser(false) above):
@@ -160,7 +160,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_network/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_network/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -11,7 +11,7 @@
 #include <signal.h>
 #include <getopt.h>
 #include <unistd.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -26,7 +26,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the oscillator\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -34,7 +34,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 440.0;		// Frequency of oscillator
 
 	struct option customOptions[] =
@@ -45,12 +45,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -67,13 +67,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -88,10 +88,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_network/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_network/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
  *      Author: parallels
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 //#include <rtdk.h>
 #include <cmath>
 #include <NetworkSend.h>
@@ -26,7 +26,7 @@
 float gFrequency;
 float gInverseSampleRate;
 float gPhase;
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	// Retrieve a parameter passed in from the initAudio() call
 	gFrequency = *(float *)userData;
@@ -44,7 +44,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		float out = 0.7f * sinf(gPhase);
@@ -64,6 +64,6 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 }
--- a/examples/basic_passthru/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_passthru/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,14 +25,14 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --help [-h]:             Print this menu\n";
 }
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -41,12 +41,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "h", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -60,13 +60,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -81,10 +81,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_passthru/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_passthru/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <rtdk.h>
 
@@ -19,7 +19,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	// Nothing to do here...
 	return true;
@@ -30,7 +30,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	// Simplest possible case: pass inputs through to outputs
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
@@ -63,7 +63,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_pulseIn/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_pulseIn/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
  *      Author: parallels
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <PulseIn.h>
 #include <Utilities.h>
 #include <stdlib.h>
@@ -26,7 +26,7 @@
 int gPulseLength = 1234;
 int gSamplesBetweenPulses = 10000;
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	pinModeFrame(context, 0, gDigitalOutPin, OUTPUT);
 	pulseIn.init(context, gPulseInPin, 1); //third parameter is direction
@@ -38,7 +38,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	static bool pulseOut = 0;
 	static int count = 0;
@@ -67,7 +67,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/basic_writeFile/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_writeFile/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the oscillator\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 440.0;	// Frequency of oscillator
 
 	struct option customOptions[] =
@@ -44,12 +44,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -66,13 +66,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -87,10 +87,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/basic_writeFile/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/basic_writeFile/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h> 
+#include <Bela.h> 
 #include <cmath>
 #include <WriteFile.h>
 
@@ -9,7 +9,7 @@
 WriteFile file1;
 WriteFile file2;
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	gInverseSampleRate = 1.0/context->audioSampleRate;
 	file1.init("out1.m"); //set the file name to write to
@@ -30,7 +30,7 @@
 	return true; 
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	static int count = 0;
 	if((count&16383) == 0){
@@ -57,7 +57,7 @@
 // cleanup_render() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in initialise_render().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
     
 }
--- a/examples/bucket_brigade_chorus/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/bucket_brigade_chorus/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h> 
+#include <Bela.h> 
 #include <Scope.h>
 #include <cmath>
 #include <Utilities.h>
@@ -39,7 +39,7 @@
 //	gPRU->clearGPIOTestPin();
 }
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	gInverseSampleRate = 1.0/context->audioSampleRate;
 	
@@ -48,7 +48,7 @@
 	
 	gFrequency1 = 200.0;
 	gFrequency2 = 201.0;
-	updatePll=BeagleRT_createAuxiliaryTask(&updatePllFunction, 91, "update PLL");
+	updatePll=Bela_createAuxiliaryTask(&updatePllFunction, 91, "update PLL");
 	for(int n=0; n<delayLength; n++){
 		delay[n]=0;
 	}
@@ -60,12 +60,12 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 //	printf("here\n");
 	static bool init = false;
 	if(init == false){
-		BeagleRT_scheduleAuxiliaryTask(updatePll);
+		Bela_scheduleAuxiliaryTask(updatePll);
 //		gAudioCodec->setPllP(2);
 //		gAudioCodec->setPllR();
 //		gAudioCodec->setAudioSamplingRate(43600);
@@ -115,7 +115,7 @@
 // cleanup_render() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in initialise_render().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
     
 }
--- a/examples/cape_test/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/cape_test/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the oscillator\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 440.0;	// Frequency of oscillator
 
 	struct option customOptions[] =
@@ -44,12 +44,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -66,13 +66,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -87,10 +87,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/cape_test/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/cape_test/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 
 #define ANALOG_LOW	(2048.0 / 65536.0)
@@ -47,7 +47,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	return true;
 }
@@ -57,7 +57,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	static float phase = 0.0;
 	static int sampleCounter = 0;
@@ -273,7 +273,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/d-box/how_to_build_dbox.txt	Fri May 27 13:58:20 2016 +0100
+++ b/examples/d-box/how_to_build_dbox.txt	Fri May 27 14:34:41 2016 +0100
@@ -1,7 +1,7 @@
 The D-Box code can be built on the board using the scripts included with
-BeagleRT. To build the code, do the following from the scripts/ directory:
+Bela. To build the code, do the following from the scripts/ directory:
 
-./setup_board.sh    # Only if BeagleRT is not already copied to the board
+./setup_board.sh    # Only if Bela is not already copied to the board
 ./build_project.sh -n ../projects/d-box  # -n means don't run yet
 
 You will now need to copy the .dbx sound files to the box. These need to
--- a/examples/d-box/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/d-box/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -33,7 +33,7 @@
 // get_opt_long
 #include <getopt.h>
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include "config.h"
 #include "sensors.h"
 #include "OscillatorBank.h"
@@ -262,7 +262,7 @@
 }
 
 
-void parseArguments(arg_data args, BeagleRTInitSettings *settings)
+void parseArguments(arg_data args, BelaInitSettings *settings)
 {
 	// Default filename;
 	gPartialFilename = strdup("D-Box_sound_250_60_40_h88_2.txt");
@@ -290,12 +290,12 @@
 	int morehelp = 0;
 	int tmp = -1;
 
-	BeagleRT_defaultSettings(settings);
+	Bela_defaultSettings(settings);
 
 	while (1)
 	{
 		int c;
-		if ((c = BeagleRT_getopt_long(args.argc, args.argv, "hf:ki:sq:r:t:l:u:o:n:g:", long_option, settings)) < 0)
+		if ((c = Bela_getopt_long(args.argc, args.argv, "hf:ki:sq:r:t:l:u:o:n:g:", long_option, settings)) < 0)
 				break;
 		switch (c)
 		{
@@ -363,7 +363,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	RT_TASK rtSensorThread;
 	const char rtSensorThreadName[] = "dbox-sensor";
 	int oscBankHopSize;
@@ -373,7 +373,7 @@
 	args.argv = argv;
 	parseArguments(args, &settings);
 
-	BeagleRT_setVerboseLevel(gVerbose);
+	Bela_setVerboseLevel(gVerbose);
 	if(gVerbose == 1 && useAudioTest)
 		cout << "main() : running in audio test mode" << endl;
 
@@ -384,7 +384,7 @@
 	oscBankHopSize = gOscBanks[gCurrentOscBank]->getHopSize()/gOscBanks[gCurrentOscBank]->getMinSpeed();
 
 	// Initialise the audio device
-	if(BeagleRT_initAudio(&settings, &oscBankHopSize) != 0)
+	if(Bela_initAudio(&settings, &oscBankHopSize) != 0)
 		return -1;
 
 	// Initialise the status LED
@@ -405,7 +405,7 @@
 	if(gVerbose == 1)
 		cout << "main() : creating audio thread" << endl;
 
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -466,12 +466,12 @@
 		usleep(100000);
 	}
 
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	if(!useAudioTest)
 		rt_task_join(&rtSensorThread);
 
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	pthread_join( keyboardThread, NULL);
 	pthread_join( logThread, NULL);
--- a/examples/d-box/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/d-box/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
  *      Author: Victor Zappi
  */
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <PRU.h>
 
 #include "StatusLED.h"
@@ -153,7 +153,7 @@
 			uint16_t *matrixIn, uint16_t *matrixOut);
 #endif
 
-bool setup(BeagleRTContext *context, void *userData) {
+bool setup(BelaContext *context, void *userData) {
 	int oscBankHopSize = *(int *)userData;
 
 	if(context->analogChannels != 8) {
@@ -229,15 +229,15 @@
 	PeakBurst[1].setSustainLevel(0.0);
 
 	// Initialise auxiliary tasks
-	if((gMediumPriorityRender = BeagleRT_createAuxiliaryTask(&render_medium_prio, BEAGLERT_AUDIO_PRIORITY - 10, "dbox-calculation-medium")) == 0)
+	if((gMediumPriorityRender = Bela_createAuxiliaryTask(&render_medium_prio, BEAGLERT_AUDIO_PRIORITY - 10, "dbox-calculation-medium")) == 0)
 		return false;
-	if((gLowPriorityRender = BeagleRT_createAuxiliaryTask(&render_low_prio, BEAGLERT_AUDIO_PRIORITY - 15, "dbox-calculation-low")) == 0)
+	if((gLowPriorityRender = Bela_createAuxiliaryTask(&render_low_prio, BEAGLERT_AUDIO_PRIORITY - 15, "dbox-calculation-low")) == 0)
 		return false;
 
 	return true;
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 #ifdef DBOX_CAPE_TEST
 	render_capetest(numMatrixFrames, numAudioFrames, audioIn, audioOut, matrixIn, matrixOut);
@@ -323,7 +323,7 @@
 				gOscillatorBufferReadPointer = 0;
 
 				gOscillatorNeedsRender = true;
-				BeagleRT_scheduleAuxiliaryTask(gMediumPriorityRender);
+				Bela_scheduleAuxiliaryTask(gMediumPriorityRender);
 			}
 		}
 #endif
@@ -418,7 +418,7 @@
 			gFeedbackOscillatorTableLength = tableLength;
 			gFeedbackOscillatorTable = gFeedbackOscillator.wavetable();
 			gDynamicWavetableNeedsRender = true;
-			BeagleRT_scheduleAuxiliaryTask(gLowPriorityRender);
+			Bela_scheduleAuxiliaryTask(gLowPriorityRender);
 		}
 
 		/*
@@ -731,7 +731,7 @@
 }
 
 // Clean up at the end of render
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	free(gOscillatorBuffer1);
 	free(gOscillatorBuffer2);
--- a/examples/filter_FIR/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/filter_FIR/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -13,7 +13,7 @@
 #include <getopt.h>
 #include <sndfile.h>				// to load audio files
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include "SampleData.h"
 
 using namespace std;
@@ -83,7 +83,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --file [-f] filename:    Name of the file to load (default is \"longsample.wav\")\n";
 	cerr << "   --help [-h]:             Print this menu\n";
@@ -91,7 +91,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	string fileName;			// Name of the sample to load
 
 	SampleData sampleData;		// User define structure to pass data retrieved from file to render function
@@ -107,12 +107,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -148,13 +148,13 @@
 
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &sampleData) != 0) {
+	if(Bela_initAudio(&settings, &sampleData) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -169,10 +169,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/filter_FIR/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/filter_FIR/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include <NE10.h>					// neon library
 #include "SampleData.h"
@@ -22,7 +22,7 @@
 ne10_uint32_t blockSize;
 ne10_float32_t *gFIRfilterState;
 
-void initialise_filter(BeagleRTContext *context);
+void initialise_filter(BelaContext *context);
 
 // Task for handling the update of the frequencies using the matrix
 AuxiliaryTask gTriggerSamplesTask;
@@ -39,7 +39,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 
 	// Retrieve a parameter passed in from the initAudio() call
@@ -61,7 +61,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		float in = 0;
@@ -85,12 +85,12 @@
 
 
 	// Request that the lower-priority task run at next opportunity
-	BeagleRT_scheduleAuxiliaryTask(gTriggerSamplesTask);
+	Bela_scheduleAuxiliaryTask(gTriggerSamplesTask);
 }
 
 // Initialise NE10 data structures to define FIR filter
 
-void initialise_filter(BeagleRTContext *context)
+void initialise_filter(BelaContext *context)
 {
 	blockSize = context->audioFrames;
 	gFIRfilterState	= (ne10_float32_t *) NE10_MALLOC ((FILTER_TAP_NUM+blockSize-1) * sizeof (ne10_float32_t));
@@ -105,7 +105,7 @@
 
 bool initialise_trigger()
 {
-	if((gTriggerSamplesTask = BeagleRT_createAuxiliaryTask(&trigger_samples, 50, "beaglert-trigger-samples")) == 0)
+	if((gTriggerSamplesTask = Bela_createAuxiliaryTask(&trigger_samples, 50, "beaglert-trigger-samples")) == 0)
 		return false;
 
 	rt_printf("Press 'a' to trigger sample, 's' to stop\n");
@@ -151,7 +151,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	delete[] gSampleData.samples;
 
--- a/examples/filter_IIR/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/filter_IIR/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -13,7 +13,7 @@
 #include <getopt.h>
 #include <sndfile.h>				// to load audio files
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include "SampleData.h"
 
 using namespace std;
@@ -84,7 +84,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --file [-f] filename:    Name of the file to load (default is \"longsample.wav\")\n";
 	cerr << "   --cutfreq [-c] freq:     Set the cut off frequency of the filter in Hz\n";
@@ -93,7 +93,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	string fileName;			// Name of the sample to load
 
 	SampleData sampleData;		// User define structure to pass data retrieved from file to render function
@@ -110,12 +110,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:c:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:c:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -154,13 +154,13 @@
 
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &sampleData) != 0) {
+	if(Bela_initAudio(&settings, &sampleData) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -175,10 +175,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/filter_IIR/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/filter_IIR/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>	// to schedule lower prio parallel process
+#include <Bela.h>	// to schedule lower prio parallel process
 #include <rtdk.h>
 #include <cmath>
 #include <stdio.h>
@@ -53,7 +53,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 
 	// Retrieve a parameter passed in from the initAudio() call
@@ -75,7 +75,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		float sample = 0;
@@ -101,8 +101,8 @@
 	}
 
 	// Request that the lower-priority tasks run at next opportunity
-	BeagleRT_scheduleAuxiliaryTask(gChangeCoeffTask);
-	BeagleRT_scheduleAuxiliaryTask(gInputTask);
+	Bela_scheduleAuxiliaryTask(gChangeCoeffTask);
+	Bela_scheduleAuxiliaryTask(gInputTask);
 }
 
 // First calculation of coefficients
@@ -139,10 +139,10 @@
 
 bool initialise_aux_tasks()
 {
-	if((gChangeCoeffTask = BeagleRT_createAuxiliaryTask(&check_coeff, 90, "beaglert-check-coeff")) == 0)
+	if((gChangeCoeffTask = Bela_createAuxiliaryTask(&check_coeff, 90, "beaglert-check-coeff")) == 0)
 		return false;
 
-	if((gInputTask = BeagleRT_createAuxiliaryTask(&read_input, 50, "beaglert-read-input")) == 0)
+	if((gInputTask = Bela_createAuxiliaryTask(&read_input, 50, "beaglert-read-input")) == 0)
 		return false;
 
 	rt_printf("Press 'a' to trigger sample, 's' to stop\n");
@@ -215,7 +215,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	delete[] gSampleData.samples;
 }
--- a/examples/gpioAnalogLoopbackTest/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/gpioAnalogLoopbackTest/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 #include <rtdk.h>
@@ -24,7 +24,7 @@
 int gDigitalInDCh = 3;
 int gAnalogOutLoopDelay;
 int gDigitalOutLoopDelay;
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	rt_printf("For this test you need the following connections:\n"
 			"analog%d out->digital%d in, analog%d out->analog%d in, "
@@ -66,7 +66,7 @@
 const int patternLength = 31;
 static int anaErrorCount = 0;
 static int digErrorCount = 0;
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	static bool writePattern[patternLength] = {
 									0,1,0,1,0,0,1,1,
@@ -196,7 +196,7 @@
 }
 
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	if(anaErrorCount == 0 && digErrorCount == 0){
 		rt_printf("Test was succesful with %d analog channels and a buffer size of %d\n", context->analogChannels, context->audioFrames);
--- a/examples/level_meter/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/level_meter/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 
@@ -43,7 +43,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {	
 	// This project makes the assumption that the audio and digital
 	// sample rates are the same. But check it to be sure!
@@ -71,7 +71,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		// Get average of audio input channels
@@ -134,7 +134,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/loggingSensors/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/loggingSensors/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -25,7 +25,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --frequency [-f] frequency: Set the frequency of the oscillator\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	float frequency = 440.0;	// Frequency of oscillator
 
 	struct option customOptions[] =
@@ -44,12 +44,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -66,13 +66,13 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &frequency) != 0) {
+	if(Bela_initAudio(&settings, &frequency) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -87,10 +87,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/loggingSensors/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/loggingSensors/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,11 +1,11 @@
-#include <BeagleRT.h> 
+#include <Bela.h> 
 #include <cmath>
 #include <WriteFile.h>
 
 WriteFile file1;
 WriteFile file2;
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	file1.init("out.bin"); //set the file name to write to
 	file1.setEchoInterval(1000);
@@ -20,7 +20,7 @@
 	return true; 
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->analogFrames; n++) {
 			file1.log(&(context->analogIn[n*context->analogFrames]), 2); // log an array of values
@@ -31,7 +31,7 @@
 // cleanup_render() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in initialise_render().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
     
 }
--- a/examples/measure_noisefloor/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/measure_noisefloor/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 extern int gBufferSize;
 
@@ -27,7 +27,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --buffer-size [-b] size  Set the analysis buffer size\n";
 	cerr << "   --help [-h]:             Print this menu\n";
@@ -35,7 +35,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -45,7 +45,7 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// By default use a longer period size because latency is not an issue
 	settings.periodSize = 32;
@@ -53,7 +53,7 @@
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hb:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hb:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'b':
@@ -73,13 +73,13 @@
 		gBufferSize = settings.periodSize;
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -94,10 +94,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/measure_noisefloor/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/measure_noisefloor/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 
@@ -32,7 +32,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {	
 	// Clear the filter data structures
 	for(int i = 0; i < 10; i++) {
@@ -47,7 +47,7 @@
 		}
 	}
 	
-	gAnalysisTask = BeagleRT_createAuxiliaryTask(analyseResults, 50, "beaglert-analyse-results");
+	gAnalysisTask = Bela_createAuxiliaryTask(analyseResults, 50, "beaglert-analyse-results");
 
 	return true;
 }
@@ -57,7 +57,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	bool bufferIsFull = false;	// Whether at least one buffer has filled
 	
@@ -110,7 +110,7 @@
 			}
 		}
 		
-		BeagleRT_scheduleAuxiliaryTask(gAnalysisTask);
+		Bela_scheduleAuxiliaryTask(gAnalysisTask);
 	}
 }
 
@@ -154,7 +154,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	for(int i = 0; i < 10; i++) {
 		delete gBuffers0[i];
--- a/examples/mpr121/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/mpr121/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <cmath>
 #include <rtdk.h>
@@ -47,14 +47,14 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	if(!mpr121.begin(1, 0x5A)) {
 		rt_printf("Error initialising MPR121\n");
 		return false;
 	}
 	
-	i2cTask = BeagleRT_createAuxiliaryTask(readMPR121, 50, "beaglert-mpr121");
+	i2cTask = Bela_createAuxiliaryTask(readMPR121, 50, "beaglert-mpr121");
 	readIntervalSamples = context->audioSampleRate / readInterval;
 	
 	for(int i = 0; i < NUM_TOUCH_PINS; i++) {
@@ -69,13 +69,13 @@
 // ADCs and DACs (if available). If only audio is available, numAnalogFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(int n = 0; n < context->audioFrames; n++) {
 		// Keep this code: it schedules the touch sensor readings
 		if(++readCount >= readIntervalSamples) {
 			readCount = 0;
-			BeagleRT_scheduleAuxiliaryTask(i2cTask);
+			Bela_scheduleAuxiliaryTask(i2cTask);
 		}
 		
 		float sample = 0.0;
@@ -102,7 +102,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	// Nothing to do here
 }
@@ -126,4 +126,4 @@
 	
 	// You can use this to read binary on/off touch state more easily
 	//rt_printf("Touched: %x\n", mpr121.touched());
-}
\ No newline at end of file
+}
--- a/examples/osc/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/osc/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <OSCServer.h>
 #include <OSCClient.h>
 
@@ -21,7 +21,7 @@
     
 }
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
     // setup the OSC server to recieve on port 7562
     oscServer.setup(7562);
@@ -48,7 +48,7 @@
 	return true;
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
     // recieve OSC messages, parse them, and send back an acknowledgment
     while (oscServer.messageWaiting()){
@@ -57,7 +57,7 @@
     }
 }
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/oscillator_bank/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/oscillator_bank/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 #include <libgen.h>
 #include <signal.h>
 #include <getopt.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 using namespace std;
 
@@ -28,7 +28,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --num-oscillators [-n] oscs: Set the number of oscillators to use (default: 32)\n";
 	cerr << "   --wavetable [-w] length:     Set the wavetable length in samples (default: 1024)\n";
@@ -37,7 +37,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 
 	struct option customOptions[] =
 	{
@@ -48,12 +48,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hn:w:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hn:w:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -81,7 +81,7 @@
 	}
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
@@ -91,7 +91,7 @@
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -106,10 +106,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/oscillator_bank/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/oscillator_bank/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include <rtdk.h>
 #include <cstdlib>
@@ -58,7 +58,7 @@
 // in from the call to initAudio().
 //
 // Return true on success; returning false halts the program.
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	srandom(time(NULL));
 
@@ -137,7 +137,7 @@
 	}
 
 	// Initialise auxiliary tasks
-	if((gFrequencyUpdateTask = BeagleRT_createAuxiliaryTask(&recalculate_frequencies, 85, "beaglert-update-frequencies")) == 0)
+	if((gFrequencyUpdateTask = Bela_createAuxiliaryTask(&recalculate_frequencies, 85, "beaglert-update-frequencies")) == 0)
 		return false;
 
 	//for(int n = 0; n < gNumOscillators; n++)
@@ -154,7 +154,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	// Initialise buffer to 0
 	memset(context->audioOut, 0, 2 * context->audioFrames * sizeof(float));
@@ -179,7 +179,7 @@
 		}
 
 		// Request that the lower-priority task run at next opportunity
-		//BeagleRT_scheduleAuxiliaryTask(gFrequencyUpdateTask);
+		//Bela_scheduleAuxiliaryTask(gFrequencyUpdateTask);
 	}
 }
 
@@ -210,7 +210,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	free(gWavetable);
 	free(gPhases);
--- a/examples/samples/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/samples/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -13,7 +13,7 @@
 #include <getopt.h>
 #include <sndfile.h>				// to load audio files
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include "SampleData.h"
 
 using namespace std;
@@ -83,7 +83,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --file [-f] filename:    Name of the file to load (default is \"sample.wav\")\n";
 	cerr << "   --help [-h]:             Print this menu\n";
@@ -91,7 +91,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	string fileName;			// Name of the sample to load
 
 	SampleData sampleData;		// User define structure to pass data retrieved from file to render function
@@ -107,12 +107,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'h':
@@ -148,13 +148,13 @@
 
 
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, &sampleData) != 0) {
+	if(Bela_initAudio(&settings, &sampleData) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -169,10 +169,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// All done!
 	return 0;
--- a/examples/samples/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/samples/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include "SampleData.h"
 
@@ -28,7 +28,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 
 	// Retrieve a parameter passed in from the initAudio() call
@@ -48,7 +48,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		float out = 0;
@@ -65,7 +65,7 @@
 	}
 
 	// Request that the lower-priority task run at next opportunity
-	BeagleRT_scheduleAuxiliaryTask(gTriggerSamplesTask);
+	Bela_scheduleAuxiliaryTask(gTriggerSamplesTask);
 }
 
 // Initialise the auxiliary task
@@ -73,7 +73,7 @@
 
 bool initialise_trigger()
 {
-	if((gTriggerSamplesTask = BeagleRT_createAuxiliaryTask(&trigger_samples, 50, "beaglert-trigger-samples")) == 0)
+	if((gTriggerSamplesTask = Bela_createAuxiliaryTask(&trigger_samples, 50, "beaglert-trigger-samples")) == 0)
 		return false;
 
 	rt_printf("Press 'a' to trigger sample, 's' to stop\n");
@@ -119,7 +119,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	delete[] gSampleData.samples;
 }
--- a/examples/scope_analogue/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/scope_analogue/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -3,7 +3,7 @@
 // frequency determined by their values
 // it then plots these on the oscilloscope
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <cmath>
 #include <Scope.h>
 
@@ -12,7 +12,7 @@
 float gInverseSampleRate;
 float gPhase;
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 
     // setup the scope with 3 channels at the audio sample rate
@@ -24,7 +24,7 @@
 	return true;
 }
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
@@ -53,7 +53,7 @@
 	}
 }
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/scope_basic/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/scope_basic/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -1,4 +1,4 @@
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Scope.h>
 #include <cmath>
 
@@ -10,7 +10,7 @@
 // instantiate the scope
 Scope scope;
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
     // tell the scope how many channels and the sample rate
     scope.setup(3, context->audioSampleRate);
@@ -23,7 +23,7 @@
 
 float lastOut = 0.0;
 float lastOut2 = 0.0;
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
     // iterate over the audio frames and create three oscillators, seperated in phase by PI/2
     for (unsigned int n=0; n<context->audioFrames; n++){
@@ -48,7 +48,7 @@
     }
 }
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 
 }
--- a/examples/stepper/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/stepper/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 
 const int kStepLengthSlow = 1000;
@@ -49,7 +49,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {	
 	// This project makes the assumption that the audio and digital
 	// sample rates are the same. But check it to be sure!
@@ -72,7 +72,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	for(unsigned int n = 0; n < context->audioFrames; n++) {
 		if(gPhase == 0 || gPhase == 1) {
@@ -145,7 +145,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	
 }
--- a/examples/tank_wars/main.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/tank_wars/main.cpp	Fri May 27 14:34:41 2016 +0100
@@ -11,7 +11,7 @@
 #include <signal.h>
 #include <getopt.h>
 #include <sndfile.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 
 extern int gScreenFramesPerSecond;
 
@@ -72,7 +72,7 @@
 {
 	cerr << "Usage: " << processName << " [options]" << endl;
 
-	BeagleRT_usage();
+	Bela_usage();
 
 	cerr << "   --fps [-f] value:           Set target frames per second\n";
 	cerr << "   --help [-h]:                Print this menu\n";
@@ -80,7 +80,7 @@
 
 int main(int argc, char *argv[])
 {
-	BeagleRTInitSettings settings;	// Standard audio settings
+	BelaInitSettings settings;	// Standard audio settings
 	string musicFileName = "music.wav";
 	string soundBoomFileName = "boom.wav";
 	string soundHitFileName = "hit.wav";
@@ -93,12 +93,12 @@
 	};
 
 	// Set default settings
-	BeagleRT_defaultSettings(&settings);
+	Bela_defaultSettings(&settings);
 
 	// Parse command-line arguments
 	while (1) {
 		int c;
-		if ((c = BeagleRT_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
+		if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
 				break;
 		switch (c) {
 		case 'f':
@@ -130,13 +130,13 @@
 	}
 	
 	// Initialise the PRU audio device
-	if(BeagleRT_initAudio(&settings, 0) != 0) {
+	if(Bela_initAudio(&settings, 0) != 0) {
 		cout << "Error: unable to initialise audio" << endl;
 		return -1;
 	}
 
 	// Start the audio device running
-	if(BeagleRT_startAudio()) {
+	if(Bela_startAudio()) {
 		cout << "Error: unable to start real-time audio" << endl;
 		return -1;
 	}
@@ -151,10 +151,10 @@
 	}
 
 	// Stop the audio device
-	BeagleRT_stopAudio();
+	Bela_stopAudio();
 
 	// Clean up any resources allocated for audio
-	BeagleRT_cleanupAudio();
+	Bela_cleanupAudio();
 
 	// Release sound files
 	if(gMusicBuffer != 0)
--- a/examples/tank_wars/render.cpp	Fri May 27 13:58:20 2016 +0100
+++ b/examples/tank_wars/render.cpp	Fri May 27 14:34:41 2016 +0100
@@ -6,7 +6,7 @@
  */
 
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <Utilities.h>
 #include "game.h"
 #include <rtdk.h>
@@ -90,7 +90,7 @@
 //
 // Return true on success; returning false halts the program.
 
-bool setup(BeagleRTContext *context, void *userData)
+bool setup(BelaContext *context, void *userData)
 {
 	srandom(time(NULL));
 
@@ -126,7 +126,7 @@
 	gSamplesUntilNextFrame = gGameFrameInterval;
 
 	// Initialise auxiliary tasks
-	if((gScreenUpdateTask = BeagleRT_createAuxiliaryTask(&screen_update, 90,
+	if((gScreenUpdateTask = Bela_createAuxiliaryTask(&screen_update, 90,
 														 "beaglert-screen-update")) == 0)
 		return false;
 
@@ -158,7 +158,7 @@
 // ADCs and DACs (if available). If only audio is available, numMatrixFrames
 // will be 0.
 
-void render(BeagleRTContext *context, void *userData)
+void render(BelaContext *context, void *userData)
 {
 	int audioIndex = 0;
 
@@ -305,7 +305,7 @@
 		if(gScreenBufferReadPointer >= gScreenBufferNextUpdateLocation &&
 		   !gScreenNextBufferReady) {
 			// Update the screen at lower priority than the audio thread
-			BeagleRT_scheduleAuxiliaryTask(gScreenUpdateTask);
+			Bela_scheduleAuxiliaryTask(gScreenUpdateTask);
 		}
 
 		gSampleCounter++;
@@ -331,7 +331,7 @@
 // cleanup() is called once at the end, after the audio has stopped.
 // Release any resources that were allocated in setup().
 
-void cleanup(BeagleRTContext *context, void *userData)
+void cleanup(BelaContext *context, void *userData)
 {
 	// Clean up the game state
 	cleanupGame();
--- a/include/BeagleRT.h	Fri May 27 13:58:20 2016 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,621 +0,0 @@
-/**
- *  @file
- *  @brief Main BeagleRT public API
- *
- *  Central control code for hard real-time audio on BeagleBone Black
- *  using PRU and Xenomai Linux extensions. 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
- */
-
-/**
- * \mainpage
- *
- * BeagleRT is a hard-real-time, ultra-low latency audio and sensor environment for
- * BeagleBone Black, which works with the BeagleBone Audio Cape or a custom "BeagleRT Cape"
- * which incorporates stereo audio with 8x, 16-bit analog inputs and outputs.
- *
- * BeagleRT is based on the Xenomai real-time Linux extensions (http://xenomai.org) and
- * uses the BeagleBone %PRU subsystem to address the audio and sensor hardware.
- *
- * Further information can be found at http://beaglert.cc
- */
-
-
-#ifndef BEAGLERT_H_
-#define BEAGLERT_H_
-
-#include <stdint.h>
-#include <unistd.h>
-#include <rtdk.h>
-#include "digital_gpio_mapping.h"
-#include <GPIOcontrol.h>
-
-// Useful constants
-
-/** \cond PRIVATE */
-#define DBOX_CAPE					// New custom cape
-#ifdef DBOX_CAPE
-#define CODEC_I2C_ADDRESS  0x18		// Address of TLV320AIC3104 codec
-#else
-#define CODEC_I2C_ADDRESS  0x1B		// Address of TLV320AIC3106 codec
-#endif
-
-#define MAX_PRU_FILENAME_LENGTH 256
-#define MAX_SERVERNAME_LENGTH 256
-/** \endcond */
-
-/**
- * \ingroup auxtask
- *
- * Xenomai priority level for audio processing. Maximum possible priority is 99.
- * In general, all auxiliary tasks should have a level lower than this unless for\
- * special purposes where the task needs to interrupt audio processing.
- */
-#define BEAGLERT_AUDIO_PRIORITY		95
-
-// Default volume levels
-
-/**
- * \addtogroup levels
- *
- * @{
- */
-
-/**
- * Default level of the audio DAC in decibels. See BeagleRT_setDACLevel().
- */
-#define DEFAULT_DAC_LEVEL	0.0
-
-/**
- * Default level of the audio ADC in decibels. See BeagleRT_setADCLevel().
- */
-#define DEFAULT_ADC_LEVEL	-6.0
-
-
-/**
- * Default level of the Programmable Gain Amplifier in decibels.
- */
-#define DEFAULT_PGA_GAIN 16
-
-/**
- * Default level of the headphone output in decibels. See BeagleRT_setHeadphoneLevel().
- */
-#define DEFAULT_HP_LEVEL	-6.0
-/** @} */
-
-/**
- * Flag for BeagleRTContext. If set, indicates the audio and analog buffers are interleaved.
- */
-#define BEAGLERT_FLAG_INTERLEAVED				(1 << 0)	// Set if buffers are interleaved
-/**
- * Flag for BeagleRTContext. If set, indicates analog outputs persist for future frames.
- */
-#define BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST	(1 << 1)	// Set if analog/digital outputs persist for future buffers
-
-/**
- * \ingroup control
- * \brief Structure containing initialisation parameters for the real-time
- * audio control system.
- *
- * This structure is initialised using BeagleRT_defaultSettings(). Its contents
- * are used up through the point of calling
- * BeagleRT_initAudio() at which point it is no longer needed.
- */
-typedef struct {
-	// These items might be adjusted by the user:
-
-	/// \brief Number of (analog) frames per period.
-	///
-	/// Number of audio frames depends on relative sample rates of the two. By default,
-	/// audio is twice the sample rate, so has twice the period size.
-	int periodSize;
-	/// Whether to use the analog input and output
-	int useAnalog;
-	/// Whether to use the 16 programmable GPIOs
-	int useDigital;
-	/// How many channels for the ADC and DAC
-	int numAnalogChannels;
-	/// How many channels for the GPIOs
-	int numDigitalChannels;
-
-	/// Whether to begin with the speakers muted
-	int beginMuted;
-	/// Level for the audio DAC output
-	float dacLevel;
-	/// Level for the audio ADC input
-	float adcLevel;
-	/// Gains for the PGA, left and right channels
-	float pgaGain[2];
-	/// Level for the headphone output
-	float headphoneLevel;
-	/// How many channels to use on the multiplexer capelet, if enabled
-	int numMuxChannels;
-
-	/// Which PRU (0 or 1) the code should run on
-	int pruNumber; 
-	/// The external .bin file to load. If empty will use PRU code from pru_rtaudio_bin.h
-	char pruFilename[MAX_PRU_FILENAME_LENGTH];
-	/// Whether to use verbose logging
-	int verbose;
-
-	// These items are application-dependent but should probably be
-	// determined by the programmer rather than the user
-
-	/// Whether audio/analog data should be interleaved
-	int interleave;
-	/// \brief Whether analog outputs should persist to future frames.
-	///
-	/// n.b. digital pins always persist, audio never does
-	int analogOutputsPersist;
-
-	// These items are hardware-dependent and should only be changed
-	// to run on different hardware
-
-	/// Where the codec can be found on the I2C bus
-	int codecI2CAddress;
-	/// Pin where amplifier mute can be found
-	int ampMutePin;
-	/// Port where the UDP server will listen
-	int receivePort;
-	/// Port where the UDP client will transmit
-	int transmitPort;
-	char serverName[MAX_SERVERNAME_LENGTH];
-} BeagleRTInitSettings;
-
-
-/**
- * \ingroup render
- * \brief Structure holding current audio and sensor settings and pointers to data buffers.
- *
- * This structure is passed to setup(), render() and cleanup(). It is
- * initialised in BeagleRT_initAudio() based on the contents of the BeagleRTInitSettings
- * structure.
- */
-typedef struct {
-	/// \brief Buffer holding audio input samples
-	///
-	/// This buffer may be in either interleaved or non-interleaved format,
-	/// depending on the contents of the BeagleRTInitSettings structure.
-	/// \b Note: this element is available in render() only.
-	float *audioIn;
-
-	/// \brief Buffer holding audio output samples
-	///
-	/// This buffer may be in either interleaved or non-interleaved format,
-	/// depending on the contents of the BeagleRTInitSettings structure.
-	/// \b Note: this element is available in render() only.
-	float *audioOut;
-
-	/// \brief Buffer holding analog input samples
-	///
-	/// This buffer may be in either interleaved or non-interleaved format,
-	/// depending on the contents of the BeagleRTInitSettings structure.
-	/// \b Note: this element is available in render() only.
-	float *analogIn;
-
-	/// \brief Buffer holding analog output samples
-	///
-	/// This buffer may be in either interleaved or non-interleaved format,
-	/// depending on the contents of the BeagleRTInitSettings structure.
-	/// \b Note: this element is available in render() only.
-	float *analogOut;
-
-	/// \brief Buffer holding digital input/output samples
-	///
-	/// \b Note: this element is available in render() only.
-	uint32_t *digital;
-
-	/// Number of audio frames per period
-	uint32_t audioFrames;
-	/// Number of audio channels (currently always 2)
-	uint32_t audioChannels;
-	/// Audio sample rate in Hz (currently always 44100.0)
-	float audioSampleRate;
-
-	/// \brief Number of analog frames per period
-	///
-	/// This will be 0 if analog I/O is disabled.
-	uint32_t analogFrames;
-
-	/// \brief Number of analog channels
-	///
-	/// This could take a value of 8, 4 or 2. This will be 0 if analog I/O is disabled.
-	uint32_t analogChannels;
-
-	/// \brief Analog sample rate in Hz
-	///
-	/// The analog sample rate depends on the number of analog channels used. If
-	/// 8 channels are used, the sample rate is 22050. If 4 channels are used, the sample
-	/// rate is 44100. If 2 channels are used, the sample rate is 88200. If analog I/O
-	/// is disabled, the sample rate is 0.
-	float analogSampleRate;
-
-	/// Number of digital frames per period
-	uint32_t digitalFrames;
-	/// \brief Number of digital channels
-	///
-	/// Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0.
-	uint32_t digitalChannels;
-	/// Digital sample rate in Hz (currently always 44100.0)
-	float digitalSampleRate;
-
-	/// \brief Number of elapsed audio samples since the start of rendering.
-	///
-	/// This holds the total number of audio samples as of the beginning of the current period. To
-	/// find the current number of analog or digital samples elapsed, multiply by the ratio of the
-	/// sample rates (e.g. half the number of analog samples will have elapsed if the analog sample
-	/// rate is 22050).
-	uint64_t audioSampleCount;
-
-	/// \brief Other audio/sensor settings
-	///
-	/// Binary combination of flags including:
-	///
-	/// BEAGLERT_FLAG_INTERLEAVED: indicates the audio and analog buffers are interleaved
-	///
-	/// BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST: indicates that writes to the analog outputs will
-	/// persist for future frames. If not set, writes affect one frame only.
-	uint32_t flags;
-} BeagleRTContext;
-
-/** \ingroup auxtask
- *
- * Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and
- * automatically cleaned up after cleanup() finishes.
- */
-typedef void* AuxiliaryTask;	// Opaque data type to keep track of aux tasks
-
-/** \ingroup render
- *
- * Flag that indicates when the audio will stop. Threads can poll this variable to indicate when
- * they should stop. Additionally, a program can set this to \c true
- * to indicate that audio processing should terminate. Calling BeagleRT_stopAudio()
- * has the effect of setting this to \c true.
- */
-extern int gShouldStop;
-
-// *** User-defined render functions ***
-
-/**
- * \defgroup render User-defined render functions
- *
- * These three functions must be implemented by the developer in every BeagleRT program.
- * Typically they appear in their own .cpp source file.
- *
- * @{
- */
-
-/**
- * \brief User-defined initialisation function which runs before audio rendering begins.
- *
- * This function runs once at the beginning of the program, after most of the system
- * initialisation has begun but before audio rendering starts. Use it to prepare any
- * memory or resources that will be needed in render().
- *
- * \param context Data structure holding information on sample rates, numbers of channels,
- * frame sizes and other state. Note: the buffers for audio, analog and digital data will
- * \b not yet be available to use. Do not attempt to read or write audio or sensor data
- * in setup().
- * \param userData An opaque pointer to an optional user-defined data structure. Whatever
- * is passed as the second argument to BeagleRT_initAudio() will appear here.
- *
- * \return true on success, or false if an error occurred. If no initialisation is
- * required, setup() should return true.
- */
-bool setup(BeagleRTContext *context, void *userData);
-
-/**
- * \brief User-defined callback function to process audio and sensor data.
- *
- * This function is called regularly by the system every time there is a new block of
- * audio and/or sensor data to process. Your code should process the requested samples
- * of data, store the results within \c context, and return.
- *
- * \param context Data structure holding buffers for audio, analog and digital data. The
- * structure also holds information on numbers of channels, frame sizes and sample rates,
- * which are guaranteed to remain the same throughout the program and to match what was
- * passed to setup().
- * \param userData An opaque pointer to an optional user-defined data structure. Will
- * be the same as the \c userData parameter passed to setup().
- */
-void render(BeagleRTContext *context, void *userData);
-
-/**
- * \brief User-defined cleanup function which runs when the program finishes.
- *
- * This function is called by the system once after audio rendering has finished, before the
- * program quits. Use it to release any memory allocated in setup() and to perform
- * any other required cleanup. If no initialisation is performed in setup(), then
- * this function will usually be empty.
- *
- * \param context Data structure holding information on sample rates, numbers of channels,
- * frame sizes and other state. Note: the buffers for audio, analog and digital data will
- * no longer be available to use. Do not attempt to read or write audio or sensor data
- * in cleanup().
- * \param userData An opaque pointer to an optional user-defined data structure. Will
- * be the same as the \c userData parameter passed to setup() and render().
- */
-void cleanup(BeagleRTContext *context, void *userData);
-
-/** @} */
-
-/**
- * \defgroup control Control and command line functions
- *
- * These functions are used to initialise the BeagleRT settings, process arguments
- * from the command line, and start/stop the audio and sensor system.
- *
- * @{
- */
-
-// *** Command-line settings ***
-
-/**
- * \brief Initialise the data structure containing settings for BeagleRT.
- *
- * This function should be called in main() before parsing any command-line arguments. It
- * sets default values in the data structure which specifies the BeagleRT settings, including
- * frame sizes, numbers of channels, volume levels and other parameters.
- *
- * \param settings Structure holding initialisation data for BeagleRT.
- */
-void BeagleRT_defaultSettings(BeagleRTInitSettings *settings);
-
-/**
- * \brief Get long options from command line argument list, including BeagleRT standard options
- *
- * This function should be used in main() to process command line options, in place of the
- * standard library getopt_long(). Internally, it parses standard BeagleRT command-line options,
- * storing the results in the settings data structure. Any options which are not part of the
- * BeagleRT standard options will be returned, as they would normally be in getopt_long().
- *
- * \param argc Number of command line options, as passed to main().
- * \param argv Array of command line options, as passed to main().
- * \param customShortOptions List of short options to be parsed, analogous to getopt_long(). This
- * list should not include any characters already parsed as part of the BeagleRT standard options.
- * \param customLongOptions List of long options to parsed, analogous to getopt_long(). This
- * list should not include any long options already parsed as part of the BeagleRT standard options.
- * \param settings Data structure holding initialisation settings for BeagleRT. Any standard options
- * parsed will automatically update this data structure.
- *
- * \return Value of the next option parsed which is not a BeagleRT standard option, or -1 when the
- * argument list has been exhausted. Similar to the return value of getopt_long() except that BeagleRT
- * standard options are handled internally and not returned.
- */
-int BeagleRT_getopt_long(int argc, char *argv[], const char *customShortOptions,
-				   const struct option *customLongOptions, BeagleRTInitSettings *settings);
-
-/**
- * \brief Print usage information for BeagleRT standard options.
- *
- * This function should be called from your code wherever you wish to print usage information for the
- * user. It will print usage information on BeagleRT standard options, after which you can print usage
- * information for your own custom options.
- */
-void BeagleRT_usage();
-
-/**
- * \brief Set level of verbose (debugging) printing.
- *
- * \param level Verbosity level of the internal BeagleRT system. 0 by default; higher values will
- * print more information. Presently all positive numbers produce the same level of printing.
- */
-void BeagleRT_setVerboseLevel(int level);
-
-
-// *** Audio control functions ***
-
-/**
- * \brief Initialise audio and sensor rendering environment.
- *
- * This function prepares audio rendering in BeagleRT. It should be called from main() sometime
- * after command line option parsing has finished. It will initialise the rendering system, which
- * in the process will result in a call to the user-defined setup() function.
- *
- * \param settings Data structure holding system settings, including numbers of channels, frame sizes,
- * volume levels and other information.
- * \param userData An opaque pointer to a user-defined data structure which will be passed to
- * setup(), render() and cleanup(). You can use this to pass custom information
- * to the rendering functions, as an alternative to using global variables.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_initAudio(BeagleRTInitSettings *settings, void *userData);
-
-/**
- * \brief Begin processing audio and sensor data.
- *
- * This function will start the BeagleRT audio/sensor system. After this function is called, the
- * system will make periodic calls to render() until BeagleRT_stopAudio() is called.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_startAudio();
-
-/**
- * \brief Stop processing audio and sensor data.
- *
- * This function will stop the BeagleRT audio/sensor system. After this function returns, no further
- * calls to render() will be issued.
- */
-int BeagleRT_startAuxiliaryTask(AuxiliaryTask it);
-void BeagleRT_stopAudio();
-
-/**
- * \brief Clean up resources from audio and sensor processing.
- *
- * This function should only be called after BeagleRT_stopAudio(). It will release any
- * internal resources for audio and sensor processing. In the process, it will call the
- * user-defined cleanup() function.
- */
-void BeagleRT_cleanupAudio();
-
-/** @} */
-
-/**
- * \defgroup levels Audio level controls
- *
- * These functions control the input and output levels for the audio codec. If a BeagleRT program
- * does not call these functions, sensible default levels will be used.
- *
- * @{
- */
-
-// *** Volume and level controls ***
-
-/**
- * \brief Set the level of the audio DAC.
- *
- * This function sets the level of all audio outputs (headphone, line, speaker). It does
- * not affect the level of the (non-audio) analog outputs.
- *
- * \b Important: do not call this function from within render(), as it does not make
- * any guarantees on real-time performance.
- *
- * \param decibels Level of the DAC output. Valid levels range from -63.5 (lowest) to
- * 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_setDACLevel(float decibels);
-
-/**
- * \brief Set the level of the audio ADC.
- *
- * This function sets the level of the audio input. It does not affect the level of the
- * (non-audio) analog inputs.
- *
- * \b Important: do not call this function from within render(), as it does not make
- * any guarantees on real-time performance.
- *
- * \param decibels Level of the ADC input. Valid levels range from -12 (lowest) to
- * 0 (highest) in steps of 1.5dB. Levels between increments of 1.5 will be rounded down.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_setADCLevel(float decibels);
-
-
-/**
- * \brief Set the gain of the audio preamplifier.
- *
- * This function sets the level of the Programmable Gain Amplifier(PGA), which
- * amplifies the signal before the ADC.
- *
- * \b Important: do not call this function from within render(), as it does not make
- * any guarantees on real-time performance.
- *
- * \param decibels Level of the PGA Valid levels range from 0 (lowest) to
- * 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded.
- * \param channel Specifies which channel to apply the gain to. Channel 0 is left,
- * channel 1 is right
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_setPgaGain(float decibels, int channel);
-
-/**
- * \brief Set the level of the onboard headphone amplifier.
- *
- * This function sets the level of the headphone output only (3-pin connector on the BeagleRT
- * cape or the output jack on the BeagleBone Audio Cape). It does not affect the level of the
- * speakers or the line out pads on the cape.
- *
- * \b Important: do not call this function from within render(), as it does not make
- * any guarantees on real-time performance.
- *
- * \param decibels Level of the DAC output. Valid levels range from -63.5 (lowest) to
- * 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_setHeadphoneLevel(float decibels);
-
-/**
- * \brief Mute or unmute the onboard speaker amplifiers.
- *
- * This function mutes or unmutes the amplifiers on the BeagleRT cape. Whether the speakers begin
- * muted or unmuted depends on the BeagleRTInitSettings structure passed to BeagleRT_initAudio().
- *
- * \b Important: do not call this function from within render(), as it does not make
- * any guarantees on real-time performance.
- *
- * \param mute 0 to enable the speakers, nonzero to mute the speakers.
- *
- * \return 0 on success, or nonzero if an error occurred.
- */
-int BeagleRT_muteSpeakers(int mute);
-
-/** @} */
-
-/**
- * \defgroup auxtask Auxiliary task support
- *
- * These functions are used to create separate real-time tasks (threads) which run at lower
- * priority than the audio processing. They can be used, for example, for large time-consuming
- * calculations which would take more than one audio frame length to process, or they could be
- * used to communicate with external hardware when that communication might block or be delayed.
- *
- * All auxiliary tasks used by the program should be created in setup(). The tasks
- * can then be scheduled at will within the render() function.
- *
- * @{
- */
-
-// *** Functions for creating auxiliary tasks ***
-
-/**
- * \brief Create a new auxiliary task.
- *
- * This function creates a new auxiliary task which, when scheduled, runs the function specified
- * in the first argument. Note that the task does not run until scheduleAuxiliaryTask() is called.
- * Auxiliary tasks should be created in setup() and never in render() itself.
- *
- * The second argument specifies the real-time priority. Valid values are between 0
- * and 99, and usually should be lower than \ref BEAGLERT_AUDIO_PRIORITY. Tasks with higher priority always
- * preempt tasks with lower priority.
- *
- * \param functionToCall Function which will run each time the auxiliary task is scheduled.
- * \param priority Xenomai priority level at which the task should run.
- * \param name Name for this task, which should be unique system-wide (no other running program should use this name).
- */
-AuxiliaryTask BeagleRT_createAuxiliaryTask(void (*functionToCall)(void*), int priority, const char *name, void* args, bool autoSchedule = false);
-AuxiliaryTask BeagleRT_createAuxiliaryTask(void (*functionToCall)(void), int priority, const char *name, bool autoSchedule = false);
-
-/**
- * \brief Start an auxiliary task so that it can be run.
- *
- * This function will start an auxiliary task but will NOT schedule it.
- * It will also set a flag in the associate InternalAuxiliaryTask to flag the
- * task as "started", so that successive calls to the same function for a given AuxiliaryTask
- * have no effect.
- * The user should never be required to call this function directly, as it is called
- * by BeagleRT_scheduleAuxiliaryTask if needed (e.g.: if a task is scheduled in setup() )
- * or immediately after starting the audio thread.
- *
-* \param task Task to start.
- */
-
-int BeagleRT_startAuxiliaryTask(AuxiliaryTask task);
-/**
- * \brief Run an auxiliary task which has previously been created.
- *
- * This function will schedule an auxiliary task to run. When the task runs, the function in the first
- * argument of createAuxiliaryTaskLoop() will be called.
- *
- * scheduleAuxiliaryTask() is typically called from render() to start a lower-priority task. The function
- * will not run immediately, but only once any active higher priority tasks have finished.
- *
- * \param task Task to schedule for running.
- */
-void BeagleRT_scheduleAuxiliaryTask(AuxiliaryTask task);
-void BeagleRT_autoScheduleAuxiliaryTasks();
-
-/** @} */
-#include <Utilities.h>
-
-#endif /* BEAGLERT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/Bela.h	Fri May 27 14:34:41 2016 +0100
@@ -0,0 +1,621 @@
+/**
+ *  @file
+ *  @brief Main Bela public API
+ *
+ *  Central control code for hard real-time audio on BeagleBone Black
+ *  using PRU and Xenomai Linux extensions. 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
+ */
+
+/**
+ * \mainpage
+ *
+ * Bela is a hard-real-time, ultra-low latency audio and sensor environment for
+ * BeagleBone Black, which works with the BeagleBone Audio Cape or a custom "Bela Cape"
+ * which incorporates stereo audio with 8x, 16-bit analog inputs and outputs.
+ *
+ * Bela is based on the Xenomai real-time Linux extensions (http://xenomai.org) and
+ * uses the BeagleBone %PRU subsystem to address the audio and sensor hardware.
+ *
+ * Further information can be found at http://beaglert.cc
+ */
+
+
+#ifndef BEAGLERT_H_
+#define BEAGLERT_H_
+
+#include <stdint.h>
+#include <unistd.h>
+#include <rtdk.h>
+#include "digital_gpio_mapping.h"
+#include <GPIOcontrol.h>
+
+// Useful constants
+
+/** \cond PRIVATE */
+#define DBOX_CAPE					// New custom cape
+#ifdef DBOX_CAPE
+#define CODEC_I2C_ADDRESS  0x18		// Address of TLV320AIC3104 codec
+#else
+#define CODEC_I2C_ADDRESS  0x1B		// Address of TLV320AIC3106 codec
+#endif
+
+#define MAX_PRU_FILENAME_LENGTH 256
+#define MAX_SERVERNAME_LENGTH 256
+/** \endcond */
+
+/**
+ * \ingroup auxtask
+ *
+ * Xenomai priority level for audio processing. Maximum possible priority is 99.
+ * In general, all auxiliary tasks should have a level lower than this unless for\
+ * special purposes where the task needs to interrupt audio processing.
+ */
+#define BEAGLERT_AUDIO_PRIORITY		95
+
+// Default volume levels
+
+/**
+ * \addtogroup levels
+ *
+ * @{
+ */
+
+/**
+ * Default level of the audio DAC in decibels. See Bela_setDACLevel().
+ */
+#define DEFAULT_DAC_LEVEL	0.0
+
+/**
+ * Default level of the audio ADC in decibels. See Bela_setADCLevel().
+ */
+#define DEFAULT_ADC_LEVEL	-6.0
+
+
+/**
+ * Default level of the Programmable Gain Amplifier in decibels.
+ */
+#define DEFAULT_PGA_GAIN 16
+
+/**
+ * Default level of the headphone output in decibels. See Bela_setHeadphoneLevel().
+ */
+#define DEFAULT_HP_LEVEL	-6.0
+/** @} */
+
+/**
+ * Flag for BelaContext. If set, indicates the audio and analog buffers are interleaved.
+ */
+#define BEAGLERT_FLAG_INTERLEAVED				(1 << 0)	// Set if buffers are interleaved
+/**
+ * Flag for BelaContext. If set, indicates analog outputs persist for future frames.
+ */
+#define BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST	(1 << 1)	// Set if analog/digital outputs persist for future buffers
+
+/**
+ * \ingroup control
+ * \brief Structure containing initialisation parameters for the real-time
+ * audio control system.
+ *
+ * This structure is initialised using Bela_defaultSettings(). Its contents
+ * are used up through the point of calling
+ * Bela_initAudio() at which point it is no longer needed.
+ */
+typedef struct {
+	// These items might be adjusted by the user:
+
+	/// \brief Number of (analog) frames per period.
+	///
+	/// Number of audio frames depends on relative sample rates of the two. By default,
+	/// audio is twice the sample rate, so has twice the period size.
+	int periodSize;
+	/// Whether to use the analog input and output
+	int useAnalog;
+	/// Whether to use the 16 programmable GPIOs
+	int useDigital;
+	/// How many channels for the ADC and DAC
+	int numAnalogChannels;
+	/// How many channels for the GPIOs
+	int numDigitalChannels;
+
+	/// Whether to begin with the speakers muted
+	int beginMuted;
+	/// Level for the audio DAC output
+	float dacLevel;
+	/// Level for the audio ADC input
+	float adcLevel;
+	/// Gains for the PGA, left and right channels
+	float pgaGain[2];
+	/// Level for the headphone output
+	float headphoneLevel;
+	/// How many channels to use on the multiplexer capelet, if enabled
+	int numMuxChannels;
+
+	/// Which PRU (0 or 1) the code should run on
+	int pruNumber; 
+	/// The external .bin file to load. If empty will use PRU code from pru_rtaudio_bin.h
+	char pruFilename[MAX_PRU_FILENAME_LENGTH];
+	/// Whether to use verbose logging
+	int verbose;
+
+	// These items are application-dependent but should probably be
+	// determined by the programmer rather than the user
+
+	/// Whether audio/analog data should be interleaved
+	int interleave;
+	/// \brief Whether analog outputs should persist to future frames.
+	///
+	/// n.b. digital pins always persist, audio never does
+	int analogOutputsPersist;
+
+	// These items are hardware-dependent and should only be changed
+	// to run on different hardware
+
+	/// Where the codec can be found on the I2C bus
+	int codecI2CAddress;
+	/// Pin where amplifier mute can be found
+	int ampMutePin;
+	/// Port where the UDP server will listen
+	int receivePort;
+	/// Port where the UDP client will transmit
+	int transmitPort;
+	char serverName[MAX_SERVERNAME_LENGTH];
+} BelaInitSettings;
+
+
+/**
+ * \ingroup render
+ * \brief Structure holding current audio and sensor settings and pointers to data buffers.
+ *
+ * This structure is passed to setup(), render() and cleanup(). It is
+ * initialised in Bela_initAudio() based on the contents of the BelaInitSettings
+ * structure.
+ */
+typedef struct {
+	/// \brief Buffer holding audio input samples
+	///
+	/// This buffer may be in either interleaved or non-interleaved format,
+	/// depending on the contents of the BelaInitSettings structure.
+	/// \b Note: this element is available in render() only.
+	float *audioIn;
+
+	/// \brief Buffer holding audio output samples
+	///
+	/// This buffer may be in either interleaved or non-interleaved format,
+	/// depending on the contents of the BelaInitSettings structure.
+	/// \b Note: this element is available in render() only.
+	float *audioOut;
+
+	/// \brief Buffer holding analog input samples
+	///
+	/// This buffer may be in either interleaved or non-interleaved format,
+	/// depending on the contents of the BelaInitSettings structure.
+	/// \b Note: this element is available in render() only.
+	float *analogIn;
+
+	/// \brief Buffer holding analog output samples
+	///
+	/// This buffer may be in either interleaved or non-interleaved format,
+	/// depending on the contents of the BelaInitSettings structure.
+	/// \b Note: this element is available in render() only.
+	float *analogOut;
+
+	/// \brief Buffer holding digital input/output samples
+	///
+	/// \b Note: this element is available in render() only.
+	uint32_t *digital;
+
+	/// Number of audio frames per period
+	uint32_t audioFrames;
+	/// Number of audio channels (currently always 2)
+	uint32_t audioChannels;
+	/// Audio sample rate in Hz (currently always 44100.0)
+	float audioSampleRate;
+
+	/// \brief Number of analog frames per period
+	///
+	/// This will be 0 if analog I/O is disabled.
+	uint32_t analogFrames;
+
+	/// \brief Number of analog channels
+	///
+	/// This could take a value of 8, 4 or 2. This will be 0 if analog I/O is disabled.
+	uint32_t analogChannels;
+
+	/// \brief Analog sample rate in Hz
+	///
+	/// The analog sample rate depends on the number of analog channels used. If
+	/// 8 channels are used, the sample rate is 22050. If 4 channels are used, the sample
+	/// rate is 44100. If 2 channels are used, the sample rate is 88200. If analog I/O
+	/// is disabled, the sample rate is 0.
+	float analogSampleRate;
+
+	/// Number of digital frames per period
+	uint32_t digitalFrames;
+	/// \brief Number of digital channels
+	///
+	/// Currently this will always be 16, unless digital I/O is disabled, in which case it will be 0.
+	uint32_t digitalChannels;
+	/// Digital sample rate in Hz (currently always 44100.0)
+	float digitalSampleRate;
+
+	/// \brief Number of elapsed audio samples since the start of rendering.
+	///
+	/// This holds the total number of audio samples as of the beginning of the current period. To
+	/// find the current number of analog or digital samples elapsed, multiply by the ratio of the
+	/// sample rates (e.g. half the number of analog samples will have elapsed if the analog sample
+	/// rate is 22050).
+	uint64_t audioSampleCount;
+
+	/// \brief Other audio/sensor settings
+	///
+	/// Binary combination of flags including:
+	///
+	/// BEAGLERT_FLAG_INTERLEAVED: indicates the audio and analog buffers are interleaved
+	///
+	/// BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST: indicates that writes to the analog outputs will
+	/// persist for future frames. If not set, writes affect one frame only.
+	uint32_t flags;
+} BelaContext;
+
+/** \ingroup auxtask
+ *
+ * Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and
+ * automatically cleaned up after cleanup() finishes.
+ */
+typedef void* AuxiliaryTask;	// Opaque data type to keep track of aux tasks
+
+/** \ingroup render
+ *
+ * Flag that indicates when the audio will stop. Threads can poll this variable to indicate when
+ * they should stop. Additionally, a program can set this to \c true
+ * to indicate that audio processing should terminate. Calling Bela_stopAudio()
+ * has the effect of setting this to \c true.
+ */
+extern int gShouldStop;
+
+// *** User-defined render functions ***
+
+/**
+ * \defgroup render User-defined render functions
+ *
+ * These three functions must be implemented by the developer in every Bela program.
+ * Typically they appear in their own .cpp source file.
+ *
+ * @{
+ */
+
+/**
+ * \brief User-defined initialisation function which runs before audio rendering begins.
+ *
+ * This function runs once at the beginning of the program, after most of the system
+ * initialisation has begun but before audio rendering starts. Use it to prepare any
+ * memory or resources that will be needed in render().
+ *
+ * \param context Data structure holding information on sample rates, numbers of channels,
+ * frame sizes and other state. Note: the buffers for audio, analog and digital data will
+ * \b not yet be available to use. Do not attempt to read or write audio or sensor data
+ * in setup().
+ * \param userData An opaque pointer to an optional user-defined data structure. Whatever
+ * is passed as the second argument to Bela_initAudio() will appear here.
+ *
+ * \return true on success, or false if an error occurred. If no initialisation is
+ * required, setup() should return true.
+ */
+bool setup(BelaContext *context, void *userData);
+
+/**
+ * \brief User-defined callback function to process audio and sensor data.
+ *
+ * This function is called regularly by the system every time there is a new block of
+ * audio and/or sensor data to process. Your code should process the requested samples
+ * of data, store the results within \c context, and return.
+ *
+ * \param context Data structure holding buffers for audio, analog and digital data. The
+ * structure also holds information on numbers of channels, frame sizes and sample rates,
+ * which are guaranteed to remain the same throughout the program and to match what was
+ * passed to setup().
+ * \param userData An opaque pointer to an optional user-defined data structure. Will
+ * be the same as the \c userData parameter passed to setup().
+ */
+void render(BelaContext *context, void *userData);
+
+/**
+ * \brief User-defined cleanup function which runs when the program finishes.
+ *
+ * This function is called by the system once after audio rendering has finished, before the
+ * program quits. Use it to release any memory allocated in setup() and to perform
+ * any other required cleanup. If no initialisation is performed in setup(), then
+ * this function will usually be empty.
+ *
+ * \param context Data structure holding information on sample rates, numbers of channels,
+ * frame sizes and other state. Note: the buffers for audio, analog and digital data will
+ * no longer be available to use. Do not attempt to read or write audio or sensor data
+ * in cleanup().
+ * \param userData An opaque pointer to an optional user-defined data structure. Will
+ * be the same as the \c userData parameter passed to setup() and render().
+ */
+void cleanup(BelaContext *context, void *userData);
+
+/** @} */
+
+/**
+ * \defgroup control Control and command line functions
+ *
+ * These functions are used to initialise the Bela settings, process arguments
+ * from the command line, and start/stop the audio and sensor system.
+ *
+ * @{
+ */
+
+// *** Command-line settings ***
+
+/**
+ * \brief Initialise the data structure containing settings for Bela.
+ *
+ * This function should be called in main() before parsing any command-line arguments. It
+ * sets default values in the data structure which specifies the Bela settings, including
+ * frame sizes, numbers of channels, volume levels and other parameters.
+ *
+ * \param settings Structure holding initialisation data for Bela.
+ */
+void Bela_defaultSettings(BelaInitSettings *settings);
+
+/**
+ * \brief Get long options from command line argument list, including Bela standard options
+ *
+ * This function should be used in main() to process command line options, in place of the
+ * standard library getopt_long(). Internally, it parses standard Bela command-line options,
+ * storing the results in the settings data structure. Any options which are not part of the
+ * Bela standard options will be returned, as they would normally be in getopt_long().
+ *
+ * \param argc Number of command line options, as passed to main().
+ * \param argv Array of command line options, as passed to main().
+ * \param customShortOptions List of short options to be parsed, analogous to getopt_long(). This
+ * list should not include any characters already parsed as part of the Bela standard options.
+ * \param customLongOptions List of long options to parsed, analogous to getopt_long(). This
+ * list should not include any long options already parsed as part of the Bela standard options.
+ * \param settings Data structure holding initialisation settings for Bela. Any standard options
+ * parsed will automatically update this data structure.
+ *
+ * \return Value of the next option parsed which is not a Bela standard option, or -1 when the
+ * argument list has been exhausted. Similar to the return value of getopt_long() except that Bela
+ * standard options are handled internally and not returned.
+ */
+int Bela_getopt_long(int argc, char *argv[], const char *customShortOptions,
+				   const struct option *customLongOptions, BelaInitSettings *settings);
+
+/**
+ * \brief Print usage information for Bela standard options.
+ *
+ * This function should be called from your code wherever you wish to print usage information for the
+ * user. It will print usage information on Bela standard options, after which you can print usage
+ * information for your own custom options.
+ */
+void Bela_usage();
+
+/**
+ * \brief Set level of verbose (debugging) printing.
+ *
+ * \param level Verbosity level of the internal Bela system. 0 by default; higher values will
+ * print more information. Presently all positive numbers produce the same level of printing.
+ */
+void Bela_setVerboseLevel(int level);
+
+
+// *** Audio control functions ***
+
+/**
+ * \brief Initialise audio and sensor rendering environment.
+ *
+ * This function prepares audio rendering in Bela. It should be called from main() sometime
+ * after command line option parsing has finished. It will initialise the rendering system, which
+ * in the process will result in a call to the user-defined setup() function.
+ *
+ * \param settings Data structure holding system settings, including numbers of channels, frame sizes,
+ * volume levels and other information.
+ * \param userData An opaque pointer to a user-defined data structure which will be passed to
+ * setup(), render() and cleanup(). You can use this to pass custom information
+ * to the rendering functions, as an alternative to using global variables.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_initAudio(BelaInitSettings *settings, void *userData);
+
+/**
+ * \brief Begin processing audio and sensor data.
+ *
+ * This function will start the Bela audio/sensor system. After this function is called, the
+ * system will make periodic calls to render() until Bela_stopAudio() is called.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_startAudio();
+
+/**
+ * \brief Stop processing audio and sensor data.
+ *
+ * This function will stop the Bela audio/sensor system. After this function returns, no further
+ * calls to render() will be issued.
+ */
+int Bela_startAuxiliaryTask(AuxiliaryTask it);
+void Bela_stopAudio();
+
+/**
+ * \brief Clean up resources from audio and sensor processing.
+ *
+ * This function should only be called after Bela_stopAudio(). It will release any
+ * internal resources for audio and sensor processing. In the process, it will call the
+ * user-defined cleanup() function.
+ */
+void Bela_cleanupAudio();
+
+/** @} */
+
+/**
+ * \defgroup levels Audio level controls
+ *
+ * These functions control the input and output levels for the audio codec. If a Bela program
+ * does not call these functions, sensible default levels will be used.
+ *
+ * @{
+ */
+
+// *** Volume and level controls ***
+
+/**
+ * \brief Set the level of the audio DAC.
+ *
+ * This function sets the level of all audio outputs (headphone, line, speaker). It does
+ * not affect the level of the (non-audio) analog outputs.
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param decibels Level of the DAC output. Valid levels range from -63.5 (lowest) to
+ * 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_setDACLevel(float decibels);
+
+/**
+ * \brief Set the level of the audio ADC.
+ *
+ * This function sets the level of the audio input. It does not affect the level of the
+ * (non-audio) analog inputs.
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param decibels Level of the ADC input. Valid levels range from -12 (lowest) to
+ * 0 (highest) in steps of 1.5dB. Levels between increments of 1.5 will be rounded down.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_setADCLevel(float decibels);
+
+
+/**
+ * \brief Set the gain of the audio preamplifier.
+ *
+ * This function sets the level of the Programmable Gain Amplifier(PGA), which
+ * amplifies the signal before the ADC.
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param decibels Level of the PGA Valid levels range from 0 (lowest) to
+ * 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded.
+ * \param channel Specifies which channel to apply the gain to. Channel 0 is left,
+ * channel 1 is right
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_setPgaGain(float decibels, int channel);
+
+/**
+ * \brief Set the level of the onboard headphone amplifier.
+ *
+ * This function sets the level of the headphone output only (3-pin connector on the Bela
+ * cape or the output jack on the BeagleBone Audio Cape). It does not affect the level of the
+ * speakers or the line out pads on the cape.
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param decibels Level of the DAC output. Valid levels range from -63.5 (lowest) to
+ * 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_setHeadphoneLevel(float decibels);
+
+/**
+ * \brief Mute or unmute the onboard speaker amplifiers.
+ *
+ * This function mutes or unmutes the amplifiers on the Bela cape. Whether the speakers begin
+ * muted or unmuted depends on the BelaInitSettings structure passed to Bela_initAudio().
+ *
+ * \b Important: do not call this function from within render(), as it does not make
+ * any guarantees on real-time performance.
+ *
+ * \param mute 0 to enable the speakers, nonzero to mute the speakers.
+ *
+ * \return 0 on success, or nonzero if an error occurred.
+ */
+int Bela_muteSpeakers(int mute);
+
+/** @} */
+
+/**
+ * \defgroup auxtask Auxiliary task support
+ *
+ * These functions are used to create separate real-time tasks (threads) which run at lower
+ * priority than the audio processing. They can be used, for example, for large time-consuming
+ * calculations which would take more than one audio frame length to process, or they could be
+ * used to communicate with external hardware when that communication might block or be delayed.
+ *
+ * All auxiliary tasks used by the program should be created in setup(). The tasks
+ * can then be scheduled at will within the render() function.
+ *
+ * @{
+ */
+
+// *** Functions for creating auxiliary tasks ***
+
+/**
+ * \brief Create a new auxiliary task.
+ *
+ * This function creates a new auxiliary task which, when scheduled, runs the function specified
+ * in the first argument. Note that the task does not run until scheduleAuxiliaryTask() is called.
+ * Auxiliary tasks should be created in setup() and never in render() itself.
+ *
+ * The second argument specifies the real-time priority. Valid values are between 0
+ * and 99, and usually should be lower than \ref BEAGLERT_AUDIO_PRIORITY. Tasks with higher priority always
+ * preempt tasks with lower priority.
+ *
+ * \param functionToCall Function which will run each time the auxiliary task is scheduled.
+ * \param priority Xenomai priority level at which the task should run.
+ * \param name Name for this task, which should be unique system-wide (no other running program should use this name).
+ */
+AuxiliaryTask Bela_createAuxiliaryTask(void (*functionToCall)(void*), int priority, const char *name, void* args, bool autoSchedule = false);
+AuxiliaryTask Bela_createAuxiliaryTask(void (*functionToCall)(void), int priority, const char *name, bool autoSchedule = false);
+
+/**
+ * \brief Start an auxiliary task so that it can be run.
+ *
+ * This function will start an auxiliary task but will NOT schedule it.
+ * It will also set a flag in the associate InternalAuxiliaryTask to flag the
+ * task as "started", so that successive calls to the same function for a given AuxiliaryTask
+ * have no effect.
+ * The user should never be required to call this function directly, as it is called
+ * by Bela_scheduleAuxiliaryTask if needed (e.g.: if a task is scheduled in setup() )
+ * or immediately after starting the audio thread.
+ *
+* \param task Task to start.
+ */
+
+int Bela_startAuxiliaryTask(AuxiliaryTask task);
+/**
+ * \brief Run an auxiliary task which has previously been created.
+ *
+ * This function will schedule an auxiliary task to run. When the task runs, the function in the first
+ * argument of createAuxiliaryTaskLoop() will be called.
+ *
+ * scheduleAuxiliaryTask() is typically called from render() to start a lower-priority task. The function
+ * will not run immediately, but only once any active higher priority tasks have finished.
+ *
+ * \param task Task to schedule for running.
+ */
+void Bela_scheduleAuxiliaryTask(AuxiliaryTask task);
+void Bela_autoScheduleAuxiliaryTasks();
+
+/** @} */
+#include <Utilities.h>
+
+#endif /* BEAGLERT_H_ */
--- a/include/Midi.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/Midi.h	Fri May 27 14:34:41 2016 +0100
@@ -8,7 +8,7 @@
 #ifndef MIDI_H_
 #define MIDI_H_
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <vector>
 
 typedef unsigned char midi_byte_t;
--- a/include/NetworkSend.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/NetworkSend.h	Fri May 27 14:34:41 2016 +0100
@@ -5,7 +5,7 @@
 #ifdef USE_JUCE
 #include <JuceHeader.h>
 #else
-#include <BeagleRT.h> 
+#include <Bela.h> 
 #include <rtdk.h>
 #include <cmath>
 #include <UdpClient.h>
--- a/include/OSCClient.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/OSCClient.h	Fri May 27 14:34:41 2016 +0100
@@ -3,7 +3,7 @@
 #define __OSCClient_H_INCLUDED__ 
 
 #include <UdpClient.h>
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <oscpkt.hh>
 #include <queue>
 
@@ -58,4 +58,4 @@
         
 };
 
-#endif
\ No newline at end of file
+#endif
--- a/include/OSCServer.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/OSCServer.h	Fri May 27 14:34:41 2016 +0100
@@ -4,7 +4,7 @@
 
 #include <UdpServer.h>
 #include <oscpkt.hh>
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <queue>
 
 #define UDP_RECIEVE_TIMEOUT_MS 20
@@ -47,4 +47,4 @@
 };
 
 
-#endif
\ No newline at end of file
+#endif
--- a/include/PRU.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/PRU.h	Fri May 27 14:34:41 2016 +0100
@@ -10,7 +10,7 @@
 
 #include <stdint.h>
 #include <native/intr.h>
-#include "../include/BeagleRT.h"
+#include "../include/Bela.h"
 
 class PRU
 {
@@ -23,7 +23,7 @@
 
 public:
 	// Constructor
-	PRU(BeagleRTContext *input_context);
+	PRU(BelaContext *input_context);
 
 	// Destructor
 	~PRU();
@@ -56,7 +56,7 @@
 	void clearGPIOTestPin();
 
 private:
-	BeagleRTContext *context;	// Overall settings
+	BelaContext *context;	// Overall settings
 
 	int pru_number;		// Which PRU we use
 	bool running;		// Whether the PRU is running
--- a/include/PulseIn.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/PulseIn.h	Fri May 27 14:34:41 2016 +0100
@@ -8,7 +8,7 @@
 #ifndef PULSEIN_H_
 #define PULSEIN_H_
 
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <vector>
 class PulseIn {
 private:
@@ -23,7 +23,7 @@
 		_digitalInput = -1;
 	};
 
-	PulseIn(BeagleRTContext* context, unsigned int digitalInput, int direction=1){
+	PulseIn(BelaContext* context, unsigned int digitalInput, int direction=1){
 		init(context, digitalInput, direction);
 	};
 	/**
@@ -36,7 +36,7 @@
 	 *  can be 1 to detect positive pulses, e.g.:( 0 0 0 0 1 1 0 0 0 0 0)
 	 *  or -1 to detect negative pulses, e.g.: ( 1 1 1 1 0 0 1 1 1 1)
 	 */
-	void init(BeagleRTContext* context, unsigned int digitalInput, int direction=1);
+	void init(BelaContext* context, unsigned int digitalInput, int direction=1);
 
 	/**
 	 * Detects pulses.
@@ -48,16 +48,16 @@
 	 * Also, results are cached (i.e.: we do not check() for pulses twice for the same context.
 	 * context->audioSampleCount is used as an identifier.
 	 */
-	void check(BeagleRTContext* context);
+	void check(BelaContext* context);
 
 	/**
 	 * Looks for the end of a pulse.
 	 *
-	 * @param context the current BeagleRTContext
+	 * @param context the current BelaContext
 	 * @param frame the frame at which to check if a pulse was detected.
 	 * @return the length of the pulse if a pulse ending was detected at sample n, zero otherwise.
 	 */
-	int hasPulsed(BeagleRTContext* context, int frame){//let's leave this in PulseIn.h to allow the compiler to optimize out the call.
+	int hasPulsed(BelaContext* context, int frame){//let's leave this in PulseIn.h to allow the compiler to optimize out the call.
 		if(_lastContext != context->audioSampleCount){ // check for pulses in the whole context and cache the result
 			check(context);
 		}
--- a/include/ReceiveAudioThread.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/ReceiveAudioThread.h	Fri May 27 14:34:41 2016 +0100
@@ -4,7 +4,7 @@
 #ifdef USE_JUCE
 #include <JuceHeader.h>
 #else
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <UdpServer.h>
 #include <vector>
 #include <iostream>
@@ -95,8 +95,8 @@
     void run();
 #else
     RTIME getLastTime();
-    void static run(); //while in BeagleRT we have a single thread that receives for all the instances.
-    //TODO: make run() private in BeagleRT
+    void static run(); //while in Bela we have a single thread that receives for all the instances.
+    //TODO: make run() private in Bela
     static void startThread();
     static void stopThread();
     static int getNumInstances();
--- a/include/Utilities.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/Utilities.h	Fri May 27 14:34:41 2016 +0100
@@ -13,13 +13,13 @@
 #ifndef UTILITIES_H_
 #define UTILITIES_H_
 
-#include "BeagleRT.h"
+#include "Bela.h"
 
 /**
  * \defgroup iofunctions I/O functions and constants
  *
  * These functions and macros are used for audio, analog and digital I/O. All the
- * I/O functions require the BeagleRTContext data structure from render() to be passed
+ * I/O functions require the BelaContext data structure from render() to be passed
  * in. This means that these functions are, by design, \b only usable from within
  * the rendering thread.
  * 
@@ -78,14 +78,14 @@
  * This function returns the value of an audio input, at the time indicated by \c frame.
  * The returned value ranges from -1 to 1.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to read the audio input. Valid values range
  * from 0 to (context->audioFrames - 1).
  * \param channel Which audio input to read. Valid values are between 0 and
  * (context->audioChannels - 1), typically 0 to 1 by default.
  * \return Value of the analog input, range  to 1.
  */
-static inline float audioReadFrame(BeagleRTContext *context, int frame, int channel);
+static inline float audioReadFrame(BelaContext *context, int frame, int channel);
 
 /**
  * \brief Write an audio output, specifying the frame number (when to write) and the channel.
@@ -93,14 +93,14 @@
  * This function sets the value of an audio output, at the time indicated by \c frame. Valid
  * values are between -1 and 1.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to write the audio output. Valid values range
  * from 0 to (context->audioFrames - 1).
  * \param channel Which analog output to write. Valid values are between 0 and
  * (context->audioChannels - 1), typically 0 to 1 by default.
  * \param value Value to write to the output, range -1 to 1.
  */
-static inline void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value);
+static inline void audioWriteFrame(BelaContext *context, int frame, int channel, float value);
 
 /**
  * \brief Read an analog input, specifying the frame number (when to read) and the channel.
@@ -108,14 +108,14 @@
  * This function returns the value of an analog input, at the time indicated by \c frame.
  * The returned value ranges from 0 to 1, corresponding to a voltage range of 0 to 4.096V.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to read the analog input. Valid values range
  * from 0 to (context->analogFrames - 1).
  * \param channel Which analog input to read. Valid values are between 0 and
  * (context->analogChannels - 1), typically 0 to 7 by default.
  * \return Value of the analog input, range 0 to 1.
  */
-static inline float analogReadFrame(BeagleRTContext *context, int frame, int channel);
+static inline float analogReadFrame(BelaContext *context, int frame, int channel);
 
 /**
  * \brief Write an analog output, specifying the frame number (when to write) and the channel.
@@ -126,14 +126,14 @@
  * The value written will persist for all future frames if BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST
  * is set in context->flags. This is the default behaviour.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to write the analog output. Valid values range
  * from 0 to (context->analogFrames - 1).
  * \param channel Which analog output to write. Valid values are between 0 and
  * (context->analogChannels - 1), typically 0 to 7 by default.
  * \param value Value to write to the output, range 0 to 1.
  */
-static inline void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value);
+static inline void analogWriteFrame(BelaContext *context, int frame, int channel, float value);
 
 /**
  * \brief Write an analog output, specifying the frame number (when to write) and the channel.
@@ -147,14 +147,14 @@
  * BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST is not set within context->flags, then
  * analogWriteFrameOnce() and analogWriteFrame() are equivalent.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to write the analog output. Valid values range
  * from 0 to (context->analogFrames - 1).
  * \param channel Which analog output to write. Valid values are between 0 and
  * (context->analogChannels - 1), typically 0 to 7 by default.
  * \param value Value to write to the output, range 0 to 1.
  */
-static inline void analogWriteFrameOnce(BeagleRTContext *context, int frame, int channel, float value);
+static inline void analogWriteFrameOnce(BelaContext *context, int frame, int channel, float value);
 
 /**
  * \brief Read a digital input, specifying the frame number (when to read) and the pin.
@@ -162,7 +162,7 @@
  * This function returns the value of a digital input, at the time indicated by \c frame.
  * The value is 0 if the pin is low, and nonzero if the pin is high (3.3V).
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to read the digital input. Valid values range
  * from 0 to (context->digitalFrames - 1).
  * \param channel Which digital pin to read. 16 pins across the P8 and P9 headers of the
@@ -170,7 +170,7 @@
  * digital_gpio_mapping.h.
  * \return Value of the digital input.
  */
-static inline int digitalReadFrame(BeagleRTContext *context, int frame, int channel);
+static inline int digitalReadFrame(BelaContext *context, int frame, int channel);
 
 /**
  * \brief Write a digital output, specifying the frame number (when to write) and the pin.
@@ -180,7 +180,7 @@
  *
  * The value written will persist for all future frames.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to write the digital output. Valid values range
  * from 0 to (context->digitalFrames - 1).
  * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
@@ -188,7 +188,7 @@
  * digital_gpio_mapping.h.
  * \param value Value to write to the output.
  */
-static inline void digitalWriteFrame(BeagleRTContext *context, int frame, int channel, int value);
+static inline void digitalWriteFrame(BelaContext *context, int frame, int channel, int value);
 
 /**
  * \brief Write a digital output, specifying the frame number (when to write) and the pin.
@@ -200,7 +200,7 @@
  * future values unchanged. This is faster than digitalWriteFrame() so is better suited
  * to applications where every frame will be written to a different value.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to write the digital output. Valid values range
  * from 0 to (context->digitalFrames - 1).
  * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
@@ -208,7 +208,7 @@
  * digital_gpio_mapping.h.
  * \param value Value to write to the output.
  */
-static inline void digitalWriteFrameOnce(BeagleRTContext *context, int frame, int channel, int value);
+static inline void digitalWriteFrameOnce(BelaContext *context, int frame, int channel, int value);
 
 /**
  * \brief Set the direction of a digital pin to input or output.
@@ -218,7 +218,7 @@
  *
  * The value written will persist for all future frames.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range
  * from 0 to (context->digitalFrames - 1).
  * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
@@ -226,7 +226,7 @@
  * digital_gpio_mapping.h.
  * \param value Direction of the pin (\c INPUT or \c OUTPUT).
  */
-static inline void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode);
+static inline void pinModeFrame(BelaContext *context, int frame, int channel, int mode);
 
 /**
  * \brief Set the direction of a digital pin to input or output.
@@ -236,7 +236,7 @@
  *
  * The value written will affect only the specified frame.
  *
- * \param context The I/O data structure which is passed by BeagleRT to render().
+ * \param context The I/O data structure which is passed by Bela to render().
  * \param frame Which frame (i.e. what time) to set the pin direction. Valid values range
  * from 0 to (context->digitalFrames - 1).
  * \param channel Which digital output to write. 16 pins across the P8 and P9 headers of the
@@ -244,7 +244,7 @@
  * digital_gpio_mapping.h.
  * \param value Direction of the pin (\c INPUT or \c OUTPUT).
  */
-static inline void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode);
+static inline void pinModeFrameOnce(BelaContext *context, int frame, int channel, int mode);
 
 /** @} */
 
@@ -335,21 +335,21 @@
 // audioReadFrame()
 //
 // Returns the value of the given audio input at the given frame number.
-static inline float audioReadFrame(BeagleRTContext *context, int frame, int channel) {
+static inline float audioReadFrame(BelaContext *context, int frame, int channel) {
 	return context->audioIn[frame * context->audioChannels + channel];
 }
 
 // audioWriteFrame()
 //
 // Sets a given audio output channel to a value for the current frame
-static inline void audioWriteFrame(BeagleRTContext *context, int frame, int channel, float value) {
+static inline void audioWriteFrame(BelaContext *context, int frame, int channel, float value) {
 	context->audioOut[frame * context->audioChannels + channel] = value;
 }
 
 // analogReadFrame()
 //
 // Returns the value of the given analog input at the given frame number.
-static inline float analogReadFrame(BeagleRTContext *context, int frame, int channel) {
+static inline float analogReadFrame(BelaContext *context, int frame, int channel) {
 	return context->analogIn[frame * context->analogChannels + channel];
 }
 
@@ -357,7 +357,7 @@
 //
 // Sets a given analog output channel to a value for the current frame and, if persistent outputs are
 // enabled, for all subsequent frames
-static inline void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value) {
+static inline void analogWriteFrame(BelaContext *context, int frame, int channel, float value) {
 	if(context->flags & BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST) {
 		for(unsigned int f = frame; f < context->analogFrames; f++)
 			context->analogOut[frame * context->analogChannels + channel] = value;
@@ -369,21 +369,21 @@
 // analogWriteFrameOnce()
 //
 // Sets a given channel to a value for only the current frame
-static inline void analogWriteFrameOnce(BeagleRTContext *context, int frame, int channel, float value) {
+static inline void analogWriteFrameOnce(BelaContext *context, int frame, int channel, float value) {
 	context->analogOut[frame * context->analogChannels + channel] = value;
 }
 
 // digitalReadFrame()
 //
 // Returns the value of a given digital input at the given frame number
-static inline int digitalReadFrame(BeagleRTContext *context, int frame, int channel) {
+static inline int digitalReadFrame(BelaContext *context, int frame, int channel) {
 	return getBit(context->digital[frame], channel + 16);
 }
 
 // digitalWriteFrame()
 //
 // Sets a given digital output channel to a value for the current frame and all subsequent frames
-static inline void digitalWriteFrame(BeagleRTContext *context, int frame, int channel, int value) {
+static inline void digitalWriteFrame(BelaContext *context, int frame, int channel, int value) {
 	for(unsigned int f = frame; f < context->digitalFrames; f++) {
 		if(value)
 			context->digital[f] |= 1 << (channel + 16);
@@ -395,7 +395,7 @@
 // digitalWriteFrameOnce()
 //
 // Sets a given digital output channel to a value for the current frame only
-static inline void digitalWriteFrameOnce(BeagleRTContext *context, int frame, int channel, int value) {
+static inline void digitalWriteFrameOnce(BelaContext *context, int frame, int channel, int value) {
 	if(value)
 		context->digital[frame] |= 1 << (channel + 16);
 	else
@@ -405,7 +405,7 @@
 // pinModeFrame()
 //
 // Sets the direction of a digital pin for the current frame and all subsequent frames
-static inline void pinModeFrame(BeagleRTContext *context, int frame, int channel, int mode) {
+static inline void pinModeFrame(BelaContext *context, int frame, int channel, int mode) {
 	for(unsigned int f = frame; f < context->digitalFrames; f++) {
 		if(mode == INPUT)
 			context->digital[f] |= (1 << channel);
@@ -417,7 +417,7 @@
 // pinModeFrameOnce()
 //
 // Sets the direction of a digital pin for the current frame only
-static inline void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode) {
+static inline void pinModeFrameOnce(BelaContext *context, int frame, int channel, int mode) {
 	if(mode == INPUT)
 		context->digital[frame] |= (1 << channel);
 	else
--- a/include/WriteFile.h	Fri May 27 13:58:20 2016 +0100
+++ b/include/WriteFile.h	Fri May 27 14:34:41 2016 +0100
@@ -7,7 +7,7 @@
 
 #ifndef WRITEMFILE_H_
 #define WRITEMFILE_H_
-#include <BeagleRT.h>
+#include <Bela.h>
 #include <vector>
 #include <stdio.h>
 #include <stdlib.h>
--- a/resources/network/network_readme.txt	Fri May 27 13:58:20 2016 +0100
+++ b/resources/network/network_readme.txt	Fri May 27 14:34:41 2016 +0100
@@ -17,7 +17,7 @@
 sends messages every 1ms to control the frequency of the oscillator, thus generating a sine sweep
 
 ./udp-server 9999
-#will print the info received from BeagleRT with the following format
+#will print the info received from Bela with the following format
 printf("%8d;%.3f;%.3;",gCounter,gFrequency,gPhase);
 example:
 88201;700.000;0.123;