diff examples/analogDigitalDemo/render.cpp @ 311:493a07f6ec09 prerelease

Renamed BelaContext->audioSampleCount to BelaContext->audioFramesElapsed for consistency of terminology
author andrewm
date Fri, 27 May 2016 18:37:51 +0100
parents 02c4ca0e3718
children db2fe4e1b88e
line wrap: on
line diff
--- a/examples/analogDigitalDemo/render.cpp	Fri May 27 18:29:20 2016 +0100
+++ b/examples/analogDigitalDemo/render.cpp	Fri May 27 18:37:51 2016 +0100
@@ -36,7 +36,7 @@
   /*
   * TODO: as an exercise, you will need to set the pin mode before writing or reading the digital pins.
   */
-	if((context->audioSampleCount&31)==0){ //every 32 frames...
+	if((context->audioFramesElapsed&31)==0){ //every 32 frames...
         //ANALOG channels
 		analogWrite(context, 0, 0, analogRead(context, 0,0));
 		// read the input0 at frame0  and write it to output0 frame0. Using analogWrite will fill the rest of the buffer with the same value
@@ -67,14 +67,14 @@
         //use digital channels 2-8 to create a 7 bit binary counter
         context->digital[n]=context->digital[n] & (~0b111111100); // set to zero (GPIO_OUTPUT) the bits in the lower word
         context->digital[n]=context->digital[n] & ((~0b111111100<<16) | 0xffff ); //initialize to zero the bits in the higher word (output value)
-        context->digital[n]=context->digital[n] | ( ((context->audioSampleCount&0b1111111)<<(16+2)) ) ;  // set the bits in the higher word to the desired output value, keeping the lower word unchanged
+        context->digital[n]=context->digital[n] | ( ((context->audioFramesElapsed&0b1111111)<<(16+2)) ) ;  // set the bits in the higher word to the desired output value, keeping the lower word unchanged
         digitalWrite(context, n, P8_29, digitalRead(context, n, P8_30)); // echo the input from from channel 15 to channel 14
         digitalWrite(context, n, P8_28, digitalRead(context, n, P9_16)); // echo the input from from channel 10 to channel 13
         pinMode(context, 0, P8_30, 0); //set channel 15 to input
 	}
 
 	for(unsigned int n=0; n<context->analogFrames; n++){
-    	analogWrite(context, n, 1, (context->audioSampleCount&8191)/8192.0); // writes a single frame. channel 1 is a ramp that follows gCountFrames
+    	analogWrite(context, n, 1, (context->audioFramesElapsed&8191)/8192.0); // writes a single frame. channel 1 is a ramp that follows gCountFrames
     	analogWrite(context, n, 2, analogRead(context, n, 2)); // writes a single frame. channel2 is just a passthrough
 //		rt_printf("Analog out frame %d :",n);
 //		for(int c=0; c<gNumAnalogChannels; c++)