Mercurial > hg > opencollidoscope
diff CollidoscopeApp/include/Chunk.h @ 2:dd889fff8423
added some comments
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Mon, 11 Jul 2016 17:03:40 +0200 |
parents | 02467299402e |
children | 75b744078d66 |
line wrap: on
line diff
--- a/CollidoscopeApp/include/Chunk.h Fri Jul 08 11:39:18 2016 +0200 +++ b/CollidoscopeApp/include/Chunk.h Mon Jul 11 17:03:40 2016 +0200 @@ -6,6 +6,15 @@ class DrawInfo; +/** + * + * 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. + * A Chunk is one of the bars of the visual wave. + * + */ + class Chunk { @@ -14,27 +23,62 @@ const static float kWidth; const static float kHalfWidth; + /** + * Constructor, takes as argument the index of this chunk in the wave + */ Chunk( size_t index ); + /** + * Sets the top value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] + */ void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } + /** + * Sets the bottom value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] + */ void inline setBottom(float b) { mAudioBottom = b; mAnimate = 0.0f; mResetting = false; } + /** + * Get the top value of this chunk. The value is returned in audio coordinates : [-1.0, 1.0] + */ float inline getTop() const { return mAudioTop; } + /** + * Get the bottom value of this chunk. The value is returned in audio coordinates : [-1.0, 1.0] + */ float inline getBottom() const { return mAudioBottom; } + /** + * Reset this chunks. When a chunk is reset it starts shrinking until it disappears. + * + */ void reset(){ mResetting = true; } + /** + * Called in the graphic loop. It update this chunk. + */ void update( const DrawInfo& di ); + /** + * Called in the graphic loop. It draws this chunk. + */ void draw( const DrawInfo& di, ci::gl::BatchRef &batch ); + /** + * Called in the graphic loop. It draws this chunk all the way to the bottom of the screen. + * This method is called when the chunk is the first or last in a selection. + */ void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); + /** + * Informs this chunk that it's the first chunk of the selection. + */ void setAsSelectionStart(bool start){ isSelectionStart = start; } + /** + * Informs this chunk that it's the last chunk of the selection. + */ void setAsSelectionEnd(bool end){ isSelectionEnd = end; }