Mercurial > hg > beaglert
comparison examples/basic_analog_input/render.cpp @ 308:1feb9c23ac57 prerelease
Renamed read/write functions to remove the Frame --> e.g. analogWriteFrameOnce -> analogWriteOnce, digitalReadFrame -> digitalRead
author | andrewm |
---|---|
date | Fri, 27 May 2016 18:21:21 +0100 |
parents | e4392164b458 |
children | db2fe4e1b88e |
comparison
equal
deleted
inserted
replaced
307:ff5f346a293e | 308:1feb9c23ac57 |
---|---|
59 // is twice as high | 59 // is twice as high |
60 | 60 |
61 for(unsigned int n = 0; n < context->audioFrames; n++) { | 61 for(unsigned int n = 0; n < context->audioFrames; n++) { |
62 if(!(n % gAudioFramesPerAnalogFrame)) { | 62 if(!(n % gAudioFramesPerAnalogFrame)) { |
63 // Even audio samples: update frequency and amplitude from the matrix | 63 // Even audio samples: update frequency and amplitude from the matrix |
64 frequency = map(analogReadFrame(context, n/gAudioFramesPerAnalogFrame, gSensorInputFrequency), 0, 1, 100, 1000); | 64 frequency = map(analogRead(context, n/gAudioFramesPerAnalogFrame, gSensorInputFrequency), 0, 1, 100, 1000); |
65 amplitude = analogReadFrame(context, n/gAudioFramesPerAnalogFrame, gSensorInputAmplitude); | 65 amplitude = analogRead(context, n/gAudioFramesPerAnalogFrame, gSensorInputAmplitude); |
66 } | 66 } |
67 | 67 |
68 float out = amplitude * sinf(gPhase); | 68 float out = amplitude * sinf(gPhase); |
69 | 69 |
70 for(unsigned int channel = 0; channel < context->audioChannels; channel++) | 70 for(unsigned int channel = 0; channel < context->audioChannels; channel++) |