changeset 16:4dad0b810f18

Comment tidy up + attributions
author Fiore Martin <f.martin@qmul.ac.uk>
date Tue, 16 Aug 2016 14:27:53 +0100
parents 5241f96479d6
children 4f09a3f3a031
files CollidoscopeApp/include/AudioEngine.h CollidoscopeApp/include/BufferToWaveRecorderNode.h CollidoscopeApp/include/Chunk.h CollidoscopeApp/include/Config.h CollidoscopeApp/include/DrawInfo.h CollidoscopeApp/include/EnvASR.h CollidoscopeApp/include/MIDI.h CollidoscopeApp/include/Messages.h CollidoscopeApp/include/Oscilloscope.h CollidoscopeApp/include/PGranular.h CollidoscopeApp/include/PGranularNode.h CollidoscopeApp/include/ParticleController.h CollidoscopeApp/include/Wave.h CollidoscopeApp/src/AudioEngine.cpp CollidoscopeApp/src/Chunk.cpp CollidoscopeApp/src/CollidoscopeApp.cpp CollidoscopeApp/src/PGranularNode.cpp CollidoscopeApp/src/ParticleController.cpp CollidoscopeApp/src/Wave.cpp
diffstat 19 files changed, 112 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/CollidoscopeApp/include/AudioEngine.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/AudioEngine.h	Tue Aug 16 14:27:53 2016 +0100
@@ -75,7 +75,7 @@
     */ 
     size_t getRecordWaveAvailable( size_t index );
     /**
-    * Called from the graphic thread. Reads count elements from the wave ring buffer into \a buffer.
+    * Called from the graphic thread. Reads \a count elements from the wave ring buffer into \a buffer.
     * The wave ring buffer is used to pass the size of the wave chunks from the audio thread to the graphic thread, 
     * when a new wave is recorded.
     *
@@ -106,7 +106,7 @@
     // nodes for recording audio input into buffer. Also sends chunks information through 
     // non-blocking queue 
     std::array< BufferToWaveRecorderNodeRef, NUM_WAVES > mBufferRecorderNodes;
-    // pgranulars for loop synths 
+    // pgranulars wrapped in a Cinder::Node 
     std::array< PGranularNodeRef, NUM_WAVES > mPGranularNodes;
 
 
--- a/CollidoscopeApp/include/BufferToWaveRecorderNode.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/BufferToWaveRecorderNode.h	Tue Aug 16 14:27:53 2016 +0100
@@ -60,8 +60,8 @@
 /**
  * A \a Node in the audio graph of the Cinder audio library that records input in a buffer.
  *
- * This class is similar to \a cinder::audio::BufferRecorderNode (it's a derivative work of this class indeed) but it has an additional feature.
- * When recording it uses the audio input samples to compute the size values of the visual chunks. 
+ * This class is similar to \a cinder::audio::BufferRecorderNode (it's a derivative work of this class indeed) but it has an additional feature:
+ * when recording, it uses the audio input samples to compute the size values of the visual chunks. 
  * The chunks values are stored in a ring buffer and fetched by the graphic thread to paint the wave as it gets recorded.
  *
  */
--- a/CollidoscopeApp/include/Chunk.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/Chunk.h	Tue Aug 16 14:27:53 2016 +0100
@@ -33,7 +33,7 @@
  *
  * A chunk of audio in Collidoscope low-fi visual wave. 
  *
- * The visual wave of Collidoscope is made out of a number of bars that mimics in a low-fi fashion the typical waveform based representation of audio.
+ * The visual wave of Collidoscope is made out of a number of bars that mimic, in a low-fi fashion, the typical waveform-based representation of audio.
  * A Chunk is one of the bars of the visual wave. 
  *
  */
@@ -47,7 +47,7 @@
     const static float kHalfWidth;
 
     /**
-     * Constructor, takes as argument the index of this chunk in the wave
+     * Constructor, takes as argument the index of this chunk in the wave that contains it
      */ 
     Chunk( size_t index );
 
@@ -69,7 +69,7 @@
     float inline getBottom() const { return mAudioBottom; }
 
     /**
-     * Reset this chunks. When a chunk is reset it starts shrinking until it disappears.
+     * Reset this chunks. When a chunk is reset, it starts shrinking until it disappears or setTop/setBottom are called again
      *
      */ 
     void reset(){
--- a/CollidoscopeApp/include/Config.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/Config.h	Tue Aug 16 14:27:53 2016 +0100
@@ -66,7 +66,7 @@
     }
 
     /**
-     * Returns wave's selection color
+     * Returns wave selection color
      */ 
     ci::Color getWaveSelectionColor(size_t waveIdx) const
     {
@@ -123,7 +123,7 @@
     /**
      * The value returned is used when creating the oscilloscope. 
      * The oscilloscope represents the audio output buffer graphically. However it doesn't need to be as refined as the 
-     * audio wave and it's downsampled using the following formula :  number of oscilloscope points = size o audio output buffer / getOscilloscopeNumPointsDivider() 
+     * audio wave and it's downsampled using the following formula :  (number of oscilloscope points) = (size of audio output buffer) / getOscilloscopeNumPointsDivider() 
      */ 
     size_t getOscilloscopeNumPointsDivider() const
     {
--- a/CollidoscopeApp/include/DrawInfo.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/DrawInfo.h	Tue Aug 16 14:27:53 2016 +0100
@@ -58,7 +58,7 @@
     }
 
     /**
-     * Maps a value in the audio space [-1.0, 1.0] to a position on the y axis of this DrawInf's bounding area.
+     * Maps a value in the audio space [-1.0, 1.0] to a position on the y axis of this DrawInfo's bounding area.
      *
      */ 
     float audioToHeigt(float audioSample) const {
@@ -99,7 +99,7 @@
     }
 
     /**
-     * Flips y according to the index of the wave. It is needed because the second wave in collidoscope is upside down from the orientation oftthe screen.
+     * Flips y according to the index of the wave. It is needed because the second wave in collidoscope is drawn upside down in the screen.
      */ 
     int flipY(int y) const 
     {
@@ -110,7 +110,7 @@
     }
 
     /**
-     * Returns x. not used at he moment.
+     * Returns x. not used at the moment.
      *
      */ 
     int flipX(int x) const
--- a/CollidoscopeApp/include/EnvASR.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/EnvASR.h	Tue Aug 16 14:27:53 2016 +0100
@@ -1,7 +1,7 @@
 /*
 
  Copyright (C) 2016  Queen Mary University of London 
- Author: Fiore Martin
+ Author: Fiore Martin, based on CCRMA STK ADSR.h (https://ccrma.stanford.edu/software/stk/classstk_1_1ADSR.html) 
 
  This file is part of Collidoscope.
  
@@ -17,6 +17,37 @@
 
  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+ This file incorporates work covered by the following copyright and permission notice:
+
+    The Synthesis ToolKit in C++ (STK)
+
+    Copyright (c) 1995--2016 Perry R. Cook and Gary P. Scavone
+
+    Permission is hereby granted, free of charge, to any person obtaining
+    a copy of this software and associated documentation files (the
+    "Software"), to deal in the Software without restriction, including
+    without limitation the rights to use, copy, modify, merge, publish,
+    distribute, sublicense, and/or sell copies of the Software, and to
+    permit persons to whom the Software is furnished to do so, subject to
+    the following conditions:
+
+    The above copyright notice and this permission notice shall be
+    included in all copies or substantial portions of the Software.
+
+    Any person wishing to distribute modifications to the Software is
+    asked to send the modifications to the original developer so that they
+    can be incorporated into the canonical version.  This is, however, not
+    a binding provision of this license.
+
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+    ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
 */
 
 #pragma once 
--- a/CollidoscopeApp/include/MIDI.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/MIDI.h	Tue Aug 16 14:27:53 2016 +0100
@@ -31,7 +31,7 @@
 
 namespace collidoscope {
 
-
+// Exception thrown by MIDI system
 class MIDIException : public std::exception
 {
 public:
@@ -118,10 +118,10 @@
     // of saving all the messages in mMIDIMessages just save the last received in mPitchBendMessages 
     // and optimize away redundant messages.
     std::array< MIDIMessage, NUM_WAVES > mPitchBendMessages;
-    // Same principle of pitch bend messages 
+    // Same principle as mPitchBendMessages
     std::array< MIDIMessage, NUM_WAVES > mFilterMessages;
 
-    // vecotr containing all the MIDI input devices detected.
+    // vector containing all the MIDI input devices detected.
     std::vector< std::unique_ptr <RtMidiIn> > mInputs;
     // Used for mutual access to the MIDI messages by the MIDI thread and the graphic thread.  
     std::mutex mMutex;
--- a/CollidoscopeApp/include/Messages.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/Messages.h	Tue Aug 16 14:27:53 2016 +0100
@@ -31,7 +31,9 @@
     // message sent when a new recording starts. The gui resets the wave upon receiving it. 
     WAVE_START,
 
+    // new grain created 
     TRIGGER_UPDATE,
+    // synth became idle
     TRIGGER_END,
 
     NOTE_ON,
@@ -43,10 +45,9 @@
 
 /** Message sent from the audio thread to the graphic wave when a new wave is recorded. 
  *  
- *  The graphic thread set the chunks of the wave to reflect the level of the recorded audio. 
- *  The algorithm takes the maximum and minimum value of a group of samples and this becomes the top and bottom of the samples.
- *  It contains the inde
- *  the cursor position when the grains are reset.
+ *  The graphic thread sets the chunks of the wave to reflect the level of the recorded audio. 
+ *  The algorithm takes the maximum and minimum value of a group of samples and this becomes the top and bottom of the chunk.
+ *  The message carries also the index of the chunk it refers to 
  */
 struct RecordWaveMsg
 {
--- a/CollidoscopeApp/include/Oscilloscope.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/Oscilloscope.h	Tue Aug 16 14:27:53 2016 +0100
@@ -44,8 +44,8 @@
         {}
 
     /**
-     * Sets the value of a point of the oscilloscope. The value is passed as an audio coordinate [-1.0, 1.0].
-     * A reference to DrawInfo is passed to calculate the graphic coordinate of the point based on the audio value passed. 
+     * Sets the value of a point of the oscilloscope. The value is passed in audio coordinates [-1.0, 1.0].
+     * A reference to DrawInfo is passed to calculate the graphic coordinate of the point based on the audio values passed. 
      */ 
     void  setPoint( int index, float audioVal, const DrawInfo &di ){
 
@@ -66,9 +66,9 @@
         mLine.getPoints()[index].x = float( di.flipX( int(xRatio) ) );
         mLine.getPoints()[index].y = float( di.flipY( int(yRatio) ) );
 
-        // add the missing line to reach the right of the window
-        // indeed the scope starts from 0 to size -1 and adds xRatio
-        // to each new point to the line from n-1 to n is missing 
+        // add the missing line to reach the right of the window.
+        // Indeed, the scope starts from 0 to size-1 and adds xRatio
+        // to each new point. The line from n-1 to n is therefore missing.
         if (index == mNumPoints - 1){
             xRatio += ( di.getWindowWidth() / mNumPoints );
             xRatio = ceil( xRatio ); // ceil because the division might left one pixel out
--- a/CollidoscopeApp/include/PGranular.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/PGranular.h	Tue Aug 16 14:27:53 2016 +0100
@@ -1,7 +1,8 @@
 /*
 
+ Copyright (C) 2002 James McCartney.
  Copyright (C) 2016  Queen Mary University of London 
- Author: Fiore Martin
+ Author: Fiore Martin, based on Supercollider's (http://supercollider.github.io) TGrains code and Ross Bencina's "Implementing Real-Time Granular Synthesis"
 
  This file is part of Collidoscope.
  
@@ -33,13 +34,13 @@
 
 /**
  * The very core of the Collidoscope audio engine: the granular synthesizer.
- * Based on SuperCollider's TGrains and Ross Becina's "Implementing Real-Time Granular Synthesis" 
+ * Based on SuperCollider's TGrains and Ross Bencina's "Implementing Real-Time Granular Synthesis" 
  *
  * It implements Collidoscope's selection-based approach to granular synthesis. 
  * A grain is basically a selection of a recorded sample of audio. 
- * Grains are played in a loop: they are retriggered each time they reach the end of the selection.
- * However, if the duration coefficient is greater than one, a new grain is re-triggered before the previous one is done. 
- * The grains start to overlap with each other and create the typical eerie sound of grnular synthesis.
+ * Grains are played in a loop: they are re-triggered each time they reach the end of the selection.
+ * However, if the duration coefficient is greater than one, a new grain is re-triggered before the previous one is done,
+ * the grains start to overlap with each other and create the typical eerie sound of grnular synthesis.
  * Also every time a new grain is triggered, it is offset of a few samples from the initial position to make the timbre more interesting.
  *
  *
@@ -75,7 +76,7 @@
     {
         double phase;    // read pointer to mBuffer of this grain 
         double rate;     // rate of the grain. e.g. rate = 2 the grain will play twice as fast
-        bool alive;      // whether this grain is alive. Not alive means it has been processed and can be replanced by another grain
+        bool alive;      // whether this grain is alive. Not alive means it has been processed and can be replaced by another grain
         size_t age;      // age of this grain in samples 
         size_t duration; // duration of this grain in samples. minimum = 4
 
@@ -91,11 +92,11 @@
      *
      * \param buffer a pointer to an array of T that contains the original sample that will be granulized
      * \param bufferLen length of buffer in samples 
-     * \rand function returning of type size_t ()(void) that is called back each time a new grain is generated. The returned value is used 
+     * \rand function of type size_t ()(void) that is called back each time a new grain is generated. The returned value is used 
      * to offset the starting sample of the grain. This adds more colour to the sound especially with small selections. 
-     * \triggerCallback function of type void ()(char, int) that is called back each time a new grain is triggered.
-     *      The function is passed the character 't' as first parameter when a new grain is triggered and the characted 't' when the synths becomes idle.
-     * \ID id of this PGrain is passed to the triggerCallback function as second parameter to identify this PGranular as the caller.
+     * \triggerCallback function of type void ()(char, int) that is called back each time a new grain is generated.
+     *      The function is passed the character 't' as first parameter when a new grain is triggered and the characted 'e' when the synth becomes idle (no sound).
+     * \ID id of this PGrain. Passed to the triggerCallback function as second parameter to identify this PGranular as the caller.
      */ 
     PGranular( const T* buffer, size_t bufferLen, size_t sampleRate, RandOffsetFunc & rand, TriggerCallbackFunc & triggerCallback, int ID ) :
         mBuffer( buffer ),
@@ -204,8 +205,8 @@
     /**
      * Runs the granular engine and stores the output in \a audioOut
      * 
-     * \param pointer to an array of T. This will be filled with the output of PGranular. It needs to be at least \a numSamples lond
-     * \param tempBuffer a temporary buffer used to store the envelope value. It needs to be at leas \a numSamples long
+     * \param pointer to an array of T. This will be filled with the output of PGranular. It needs to be at least \a numSamples long
+     * \param tempBuffer a temporary buffer used to store the envelope value. It needs to be at least \a numSamples long
      * \param numSamples number of samples to be processed 
      */ 
     void process( T* audioOut, T* tempBuffer, size_t numSamples )
@@ -318,11 +319,11 @@
 
     // synthesize a single grain 
     // audioOut = pointer to audio block to fill 
-    // numSamples = numpber of samples to process for this block
+    // numSamples = number of samples to process for this block
     void synthesizeGrain( PGrain &grain, T* audioOut, T* envelopeValues, size_t numSamples )
     {
 
-        // copy all grain data into local variable for faster porcessing
+        // copy all grain data into local variable for faster processing
         const auto rate = grain.rate;
         auto phase = grain.phase;
         auto age = grain.age;
@@ -364,8 +365,8 @@
         }
 
         if ( age == duration ){
-            // if it porocessed all the samples left to leave ( numSamplesToOut = duration-age)
-            // then the grain is had finished 
+            // if it processed all the samples left to leave ( numSamplesToOut = duration-age)
+            // then the grain is finished 
             grain.alive = false;
         }
         else{
@@ -398,15 +399,15 @@
     // length of mBuffer in samples 
     const size_t mBufferLen;
 
-    // offset in the buffer where the grains start. a.k.a. seleciton start 
+    // offset in the buffer where the grains start. a.k.a. selection start 
     size_t mGrainsStart;
 
-    // attenuates signal prevents clipping of grains 
+    // attenuates signal prevents clipping of grains (to some degree)
     T mAttenuation;
 
     // grain duration in samples 
     double mGrainsDurationCoeff;
-    // duration of grains is selcection size * duration coeff
+    // duration of grains is selection size * duration coeff
     size_t mGrainsDuration;
     // rate of grain, affects pitch 
     double mGrainsRate;
--- a/CollidoscopeApp/include/PGranularNode.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/PGranularNode.h	Tue Aug 16 14:27:53 2016 +0100
@@ -40,7 +40,7 @@
 struct RandomGenerator;
 
 /*
-A node in the Cinder audio graph that holds a PGranular 
+A node in the Cinder audio graph that holds PGranulars for loop and keyboard playing  
 */
 class PGranularNode : public ci::audio::Node
 {
@@ -82,7 +82,7 @@
 private:
 
     // Wraps a std::atomic but get() returns a boost::optional that is set to a real value only when the atomic has changed. 
-    //  It is used to avoid calling PGranulat setter methods with *  the same value at each audio callback.
+    //  It is used to avoid calling PGranular setter methods with the same value at each audio callback.
     template< typename T>
     class LazyAtomic
     {
@@ -120,13 +120,13 @@
     // pointers to PGranular objects 
     std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > > mPGranularLoop;
     std::array<std::unique_ptr < collidoscope::PGranular<float, RandomGenerator, PGranularNode > >, kMaxVoices> mPGranularNotes;
-    // maps midi notes to pgranulars. When a noteOff is received maks sure the right PGranular is turned off
+    // maps midi notes to pgranulars. When a noteOff is received makes sure the right PGranular is turned off
     std::array<int, kMaxVoices> mMidiNotes;
 
     // pointer to the random generator struct passed over to PGranular 
     std::unique_ptr< RandomGenerator > mRandomOffset;
     
-    // buffer containing the recorder audio, to pass to PGranular in initialize()
+    // buffer containing the recorded audio, to pass to PGranular in initialize()
     ci::audio::Buffer *mGrainBuffer;
 
     ci::audio::BufferRef mTempBuffer;
--- a/CollidoscopeApp/include/ParticleController.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/ParticleController.h	Tue Aug 16 14:27:53 2016 +0100
@@ -36,7 +36,7 @@
         ci::vec2	mCloudCenter; // initial positin of the particle 
         ci::vec2	mVel;         // velocity 
         float       mCloudSize;   // how big is the area where particle float around. When a particle hits the 
-                                  //   border of the area it gets deflected 
+                                  // border of the area it gets deflected 
 
         int			mAge;      // when mAge == mLifeSpan the particle is disposed 
         int			mLifespan; // how long a particle lives
--- a/CollidoscopeApp/include/Wave.h	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/include/Wave.h	Tue Aug 16 14:27:53 2016 +0100
@@ -88,7 +88,7 @@
         void setSize( size_t size );
         
         /** The particle spread parameter affects the size of the cloud of particles
-         *  The cloud is the visual conterpart of the grain duration coefficien in sound.
+         *  The cloud is the visual counterpart of the grain duration coefficient in sound.
          *  Indeed spread accepts values from 1 to 8, exactly as the duration coefficient
          */
         void inline setParticleSpread( float spread ){
@@ -148,7 +148,7 @@
 
     /* Maps id of the synth to cursor. There is one cursor for each Synth being played */
     std::map < SynthID, Cursor > mCursors;
-    /** Holds the positions of the cursor, namely on which chunk the cursor is currently */
+    /** Holds the positions of the cursor, namely on which chunk the cursor is currently on */
     std::vector<int> mCursorsPos;
 
 public:
@@ -156,13 +156,12 @@
     // value used to identify the loop for cursor position 
     static const int kLoopNote = -1;
     static const cinder::Color CURSOR_CLR;
-    /* must be in sync with supercollider durationFactor ControlSpec max */
     static const int MAX_DURATION = 8;
 #ifdef USE_PARTICLES
     static const int PARTICLESIZE_COEFF = 40;
 #endif
 
-    /** Resetting a wave makes it shrink until it disappears. Each time a new sample is recorder the wave is reset
+    /** Resetting a wave makes it shrink until it disappears. Each time a new sample is recorded, the wave is reset.
      *  \param onlyChunks if false the selection is also set to null, if true only the chunks are reset
      */
     void reset(bool onlyChunks);
@@ -174,7 +173,7 @@
 
     const Chunk & getChunk(size_t index);
 
-    /** places the cursor on the wave. Every cursor is associated to a synth voice of the audio engine. 
+    /** Places the cursor on the wave. Every cursor is associated to a synth voice of the audio engine. 
      *  The synth id identifies uniquely the cursor in the internal map of the wave.
      *  If the cursor doesn't exist it is created */
     inline void setCursorPos( SynthID id, int pos, const DrawInfo& di ){
@@ -184,14 +183,14 @@
         cursor.lastUpdate = ci::app::getElapsedSeconds();
 
 #ifdef USE_PARTICLES
-        // The idea is that, if the duration is greater than 1.0, the cursor continues in form of particles
-        // The smaller the selection the more particles; the bigger the duration the more particles 
+        // The idea is that, if the duration is greater than 1.0, the cursor continues in form of particles.
+        // The smaller the selection the more particles; the bigger the duration the more particles. 
         if (mSelection.getParticleSpread() > 1.0f){
             /* amountCoeff ranges from 1/8 to 1 */
             const float amountCoeff = (mSelection.getParticleSpread() / MAX_DURATION);
                 
             /* get radom point within seleciton as center of the particle */
-            vec2 centrePoint; // was former getRandomPoint
+            vec2 centrePoint;
             const int randomChunkIndex = ci::Rand::randInt(mSelection.getStart(), mSelection.getEnd() );
 
             centrePoint.x = di.flipX( 1 + (randomChunkIndex * (2 + Chunk::kWidth)) + Chunk::kWidth / 2 );
@@ -243,6 +242,7 @@
 
     cinder::Color mColor;
 
+    // How much filter is applied in audio. It affects the alpha value of the selection color.
     float mFilterCoeff;
 
     // cinder gl batch for batch drawing 
--- a/CollidoscopeApp/src/AudioEngine.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/AudioEngine.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -21,8 +21,8 @@
 */
 
 #include "AudioEngine.h"
+// app.h include not used 
 #include "cinder/app/App.h"
-//FIXME remove App.h include 
 #include "Log.h"
 
 using namespace ci::audio;
@@ -87,7 +87,7 @@
     /* audio context */
     auto ctx = Context::master();
 
-    /* audio inpu device */
+    /* audio input device */
     auto inputDeviceNode = ctx->createInputDeviceNode( Device::getDefaultInput() );
  
 
@@ -102,13 +102,13 @@
         /* this prevents the node from recording before record is pressed */
         mBufferRecorderNodes[chan]->setAutoEnabled( false );
 
-        // route the input part of the audio graph. Two channels input goes into
-        // one channel route and to one channel buffer recorder 
+        // route the input part of the audio graph. Two channels input goes into one channel route
+        // and from one channel route to one channel buffer recorder 
         inputDeviceNode >> mInputRouterNodes[chan]->route( chan, 0, 1 ) >> mBufferRecorderNodes[chan];
 
 
         // create PGranular loops passing the buffer of the RecorderNode as argument to the contructor 
-        // use -1 as ID 
+        // use -1 as ID as the loop corresponds to no midi note 
         mPGranularNodes[chan] = ctx->makeNode( new PGranularNode( mBufferRecorderNodes[chan]->getRecorderBuffer(), mCursorTriggerRingBufferPacks[chan]->getBuffer() ) );
 
         // create filter nodes 
@@ -126,7 +126,7 @@
         // filter goes to output 
         mLowPassFilterNodes[chan] >> mOutputRouterNodes[chan]->route( 0, chan, 1 ) >> ctx->getOutput();
         
-        // what goes to output goes to scope 
+        // what goes to output goes to oscilloscope as well
         mLowPassFilterNodes[chan] >> mOutputMonitorNodes[chan];
 
     }
--- a/CollidoscopeApp/src/Chunk.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/Chunk.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -44,7 +44,7 @@
 void Chunk::update( const DrawInfo &di )
 {
     using namespace ci;
-    /* if resetting animate the chunks to shrink to 0 size */
+    /* if resetting animate the chunks to nicely shrink to 0 size */
     if ( mResetting ){
         if ( mAnimate > 0.0f ){
             mAnimate -= 0.1f;
@@ -64,7 +64,7 @@
         }
     }
 
-    mX = di.flipX( 1 + (mIndex * (2 + kWidth)) ); // FIXME this should happen only once when resized 
+    mX = di.flipX( 1 + (mIndex * (2 + kWidth)) ); // FIXME more efficient if it happens only once when resized 
 }
 
 void Chunk::draw( const DrawInfo& di, ci::gl::BatchRef &batch ){
@@ -74,11 +74,10 @@
 
     const float chunkHeight = mAnimate * mAudioTop * di.getMaxChunkHeight();
 
-    // place the chunk in the right position brigns back the y of chunkHeight/2 so
+    // place the chunk in the right position brings back the y of chunkHeight/2 so
     // so that after scaling the wave is still centered at the wave center 
     gl::translate( mX, di.getWaveCenterY() - ( chunkHeight / 2 ) - 1 );
 
-    // FIXME todo use max between top and bottom
     // scale according to audio amplitude 
     gl::scale( 1.0f, chunkHeight );
     batch->draw();
--- a/CollidoscopeApp/src/CollidoscopeApp.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/CollidoscopeApp.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -65,8 +65,9 @@
     array< shared_ptr< Wave >, NUM_WAVES > mWaves;
     array< shared_ptr< DrawInfo >, NUM_WAVES > mDrawInfos;
     array< shared_ptr< Oscilloscope >, NUM_WAVES > mOscilloscopes;
-    // buffers to read the wave messages as a new wave gets recorded 
+    // buffer to read the WAVE_* messages as a new wave gets recorded 
     array< RecordWaveMsg*, NUM_WAVES> mRecordWaveMessageBuffers;
+    //buffer to read the TRIGGER_* messages as the pgranulars play
     array< vector< CursorTriggerMsg >, NUM_WAVES > mCursorTriggerMessagesBuffers;
 
     double mSecondsPerChunk;
--- a/CollidoscopeApp/src/PGranularNode.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/PGranularNode.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -65,7 +65,7 @@
 {
     mTempBuffer = std::make_shared< ci::audio::Buffer >( getFramesPerBlock() );
 
-    mRandomOffset.reset( new RandomGenerator( getSampleRate() / 100 ) ); // divided by 100 corresponds to times 0.01 in the time domain 
+    mRandomOffset.reset( new RandomGenerator( getSampleRate() / 100 ) ); // divided by 100 corresponds to multiplied by 0.01 in the time domain 
 
     /* create the PGranular object for looping */
     mPGranularLoop.reset( new collidoscope::PGranular<float, RandomGenerator, PGranularNode>( mGrainBuffer->getData(), mGrainBuffer->getNumFrames(), getSampleRate(), *mRandomOffset, *this, -1 ) );
@@ -132,7 +132,7 @@
     }
 }
 
-// Called back when new grnular is triggered of turned off. Sends notification message to graphic thread.
+// Called back when new PGranular is triggered or turned off. Sends notification message to graphic thread.
 void PGranularNode::operator()( char msgType, int ID ) {
 
     switch ( msgType ){
@@ -167,7 +167,7 @@
         }
 
         if ( !synthFound ){
-            // then look for a free synth 
+            // then look for a free voice 
             for ( int i = 0; i < kMaxVoices; i++ ){
 
                 if ( mMidiNotes[i] == kNoMidiNote ){
--- a/CollidoscopeApp/src/ParticleController.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/ParticleController.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -33,7 +33,7 @@
 mNumParticles( 0 )
 
 {
-    // uses Cinder (and OpenGL) virtual buffer object based drawing
+    // uses Cinder (and OpenGL) drawing based on virtual buffer object
     // see ParticleSphereCPU example in Cinder library 
      
     mParticles.assign( kMaxParticles, Particle() );
@@ -97,7 +97,7 @@
 
 void ParticleController::updateParticles()
 {
-    // update the positions of the particles and dispose them if they're reached their timespan
+    // update the positions of the particles and dispose them if they've reached their timespan
     for ( size_t i = 0; i < mNumParticles; i++ ){
 
         Particle &particle = mParticles[i];
@@ -132,7 +132,7 @@
 
 void ParticleController::addParticles(int amount, const vec2 &initialLocation, const float cloudSize)
 {
-    // reduce the particles liearly to the total number of particles already present 
+    // reduce the particles linearly to the total number of particles already present 
     // the more particles aleary present the less particle are added
     int reduction = ci::lmap<int>(mNumParticles, 0, kMaxParticles, 0, kMaxParticleAdd);
     amount -= reduction;
--- a/CollidoscopeApp/src/Wave.cpp	Mon Aug 15 17:00:22 2016 +0100
+++ b/CollidoscopeApp/src/Wave.cpp	Tue Aug 16 14:27:53 2016 +0100
@@ -87,9 +87,9 @@
 
         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 
+        // A chunk of audio corresponds to a certain time lenght of audio, according to sample rate.
+        // Use elapsed time to advance through chunks so that the cursor is animated. 
+        // So it goes from start to end of the selection in the time span of the grain 
         itr->second.pos = mSelection.getStart() + int( elapsed / secondsPerChunk );
 
         // check we don't go too far off 
@@ -160,7 +160,7 @@
                 gl::color(mSelection.getColor().r, mSelection.getColor().g, mSelection.getColor().b, selectionAlpha);
             }
 
-            // check if one of the cursors is positioned in this chunk  
+            // check if one of the cursors is positioned in this chunk, and draw it white if it is 
             if (std::find(mCursorsPos.begin(), mCursorsPos.end(),i) != mCursorsPos.end() ){
                 gl::color(CURSOR_CLR);
                 mChunks[i].draw( di, mChunkBatch );
@@ -176,7 +176,7 @@
                 /* draw the selection bar with a transparent selection color */
                 gl::color(mSelection.getColor().r, mSelection.getColor().g, mSelection.getColor().b, 0.5f);
                 mChunks[i].drawBar( di, mChunkBatch );
-                /* set the colo to the wave */
+                /* set the color to the wave */
                 gl::color(this->mColor);  
             }
         }