diff include/Utilities.h @ 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 d7148d21aaa5
children 421a69d42943
line wrap: on
line diff
--- 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