Mercurial > hg > beaglert
comparison examples/basic_button/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 | 02c4ca0e3718 |
comparison
equal
deleted
inserted
replaced
307:ff5f346a293e | 308:1feb9c23ac57 |
---|---|
40 */ | 40 */ |
41 | 41 |
42 void render(BelaContext *context, void *userData) | 42 void render(BelaContext *context, void *userData) |
43 { | 43 { |
44 for(unsigned int n=0; n<context->digitalFrames; n++){ | 44 for(unsigned int n=0; n<context->digitalFrames; n++){ |
45 int status=digitalReadFrame(context, 0, P8_08); //read the value of the button | 45 int status=digitalRead(context, 0, P8_08); //read the value of the button |
46 digitalWriteFrameOnce(context, n, P8_07, status); //write the status to the LED | 46 digitalWriteOnce(context, n, P8_07, status); //write the status to the LED |
47 float out = 0.1 * status * rand() / (float)RAND_MAX * 2 - 1; //generate some noise, gated by the button | 47 float out = 0.1 * status * rand() / (float)RAND_MAX * 2 - 1; //generate some noise, gated by the button |
48 for(unsigned int j = 0; j < context->audioChannels; j++){ | 48 for(unsigned int j = 0; j < context->audioChannels; j++){ |
49 audioWriteFrame(context, n, j, out); //write the audio output | 49 audioWrite(context, n, j, out); //write the audio output |
50 } | 50 } |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 // cleanup() is called once at the end, after the audio has stopped. | 54 // cleanup() is called once at the end, after the audio has stopped. |