diff include/Utilities.h @ 13:6adb088196a7

Fixed ADC bug; added a simple passthrough test
author andrewm
date Fri, 23 Jan 2015 15:17:09 +0000
parents 09f03ac40fcc
children 670be80463a3
line wrap: on
line diff
--- a/include/Utilities.h	Thu Jan 22 19:00:22 2015 +0000
+++ b/include/Utilities.h	Fri Jan 23 15:17:09 2015 +0000
@@ -8,12 +8,15 @@
 #ifndef UTILITIES_H_
 #define UTILITIES_H_
 
+extern int gNumAudioChannels;	// How many audio channels are present
+extern int gNumMatrixChannels;	// How many matrix channels are present
+
 // Macros for accessing the matrix values: usable _only_ within render()
 
 // Read an analog input from input pin p at frame f
-#define analogRead(p, f) (matrixIn[(f)*8 + (p)])
+#define analogRead(p, f) (matrixIn[(f)*gNumMatrixChannels + (p)])
 // Write an analog output frame at output pin p, frame f, to value v
-#define analogWrite(p, f, v) (matrixOut[(f)*8 + (p)] = (uint16_t)(v))
+#define analogWrite(p, f, v) (matrixOut[(f)*gNumMatrixChannels + (p)] = (uint16_t)(v))
 
 float map(float x, float in_min, float in_max, float out_min, float out_max);
 float constrain(float x, float min_val, float max_val);