diff core/Utilities.cpp @ 179:f1012082f142

Added audioReadFrame() and audioWriteFrame(). Closes #1519
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 02 Jan 2016 13:50:36 +0100
parents 8bd351ca8b46
children
line wrap: on
line diff
--- a/core/Utilities.cpp	Sat Jan 02 13:08:39 2016 +0100
+++ b/core/Utilities.cpp	Sat Jan 02 13:50:36 2016 +0100
@@ -7,6 +7,20 @@
 
 #include "../include/Utilities.h"
 
+// audioReadFrame()
+//
+// Returns the value of the given audio input at the given frame number.
+float audioReadFrame(BeagleRTContext *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
+void audioWriteFrame(BeagleRTContext *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.
@@ -16,7 +30,7 @@
 
 // analogWriteFrame()
 //
-// Sets a given channel to a value for the current frame and, if persistent outputs are
+// Sets a given analog output channel to a value for the current frame and, if persistent outputs are
 // enabled, for all subsequent frames
 void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value) {
 	if(context->flags & BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST) {