Mercurial > hg > beaglert
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:f34c63568523 | 5:09f03ac40fcc |
---|---|
62 // is twice as high | 62 // is twice as high |
63 | 63 |
64 for(int n = 0; n < numAudioFrames; n++) { | 64 for(int n = 0; n < numAudioFrames; n++) { |
65 if(!(n % 2)) { | 65 if(!(n % 2)) { |
66 // Even audio samples: update frequency and amplitude from the matrix | 66 // Even audio samples: update frequency and amplitude from the matrix |
67 frequency = map((float)matrixIn[gSensorInputFrequency], 0, MATRIX_MAX, 100, 1000); | 67 frequency = map((float)analogRead(gSensorInputFrequency, n/2), 0, MATRIX_MAX, 100, 1000); |
68 amplitude = (float)matrixIn[gSensorInputAmplitude] / MATRIX_MAX; | 68 amplitude = (float)analogRead(gSensorInputAmplitude, n/2) / MATRIX_MAX; |
69 } | 69 } |
70 | 70 |
71 float out = amplitude * sinf(gPhase); | 71 float out = amplitude * sinf(gPhase); |
72 | 72 |
73 for(int channel = 0; channel < gNumChannels; channel++) | 73 for(int channel = 0; channel < gNumChannels; channel++) |