Mercurial > hg > beaglert
diff projects/basic_sensor/render.cpp @ 5:09f03ac40fcc
API improvements and cleanups. Now all common audio command-line options can be parsed automatically.
author | andrewm |
---|---|
date | Sat, 08 Nov 2014 16:16:55 +0100 |
parents | 8a575ba3ab52 |
children | a6beeba3a648 |
line wrap: on
line diff
--- a/projects/basic_sensor/render.cpp Thu Nov 06 19:02:48 2014 +0000 +++ b/projects/basic_sensor/render.cpp Sat Nov 08 16:16:55 2014 +0100 @@ -64,8 +64,8 @@ for(int n = 0; n < numAudioFrames; n++) { if(!(n % 2)) { // Even audio samples: update frequency and amplitude from the matrix - frequency = map((float)matrixIn[gSensorInputFrequency], 0, MATRIX_MAX, 100, 1000); - amplitude = (float)matrixIn[gSensorInputAmplitude] / MATRIX_MAX; + frequency = map((float)analogRead(gSensorInputFrequency, n/2), 0, MATRIX_MAX, 100, 1000); + amplitude = (float)analogRead(gSensorInputAmplitude, n/2) / MATRIX_MAX; } float out = amplitude * sinf(gPhase);