diff CollidoscopeApp/src/Wave.cpp @ 4:ab6db404403a

commented JackDevice
author Fiore Martin <f.martin@qmul.ac.uk>
date Wed, 13 Jul 2016 12:31:37 +0200
parents 7fb593d53361
children 75b744078d66
line wrap: on
line diff
--- a/CollidoscopeApp/src/Wave.cpp	Tue Jul 12 18:29:38 2016 +0200
+++ b/CollidoscopeApp/src/Wave.cpp	Wed Jul 13 12:31:37 2016 +0200
@@ -16,6 +16,7 @@
 		mChunks.emplace_back( i );
 	}
 
+    // init cinder batch drawing
     auto lambert = gl::ShaderDef().color();
     gl::GlslProgRef shader = gl::getStockShader( lambert );
     mChunkBatch = gl::Batch::create( geom::Rect( ci::Rectf( 0, 0, Chunk::kWidth, 1 ) ), shader );
@@ -63,9 +64,12 @@
 
         double elapsed = now - itr->second.lastUpdate;
 
+        // A chunk of audio corresponds to a certain time according to sample rate.
+        // Use elapsed time to advance through chunks so that the cursor is animated 
+        // and goes from start to end of the seleciton in the time span of the grain 
         itr->second.pos = mSelection.getStart() + int( elapsed / secondsPerChunk );
 
-        /* check we don't go too far off */
+        // check we don't go too far off 
         if (itr->second.pos > mSelection.getEnd()){
             itr->second.pos = Cursor::kNoPosition;
         }