Mercurial > hg > opencollidoscope
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:b5bcad8e7803 | 2:dd889fff8423 |
---|---|
3 | 3 |
4 #include "cinder/Color.h" | 4 #include "cinder/Color.h" |
5 #include "cinder/gl/Batch.h" | 5 #include "cinder/gl/Batch.h" |
6 | 6 |
7 class DrawInfo; | 7 class DrawInfo; |
8 | |
9 /** | |
10 * | |
11 * A chunk of audio in Collidoscope low-fi visual wave. | |
12 * | |
13 * 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. | |
14 * A Chunk is one of the bars of the visual wave. | |
15 * | |
16 */ | |
8 | 17 |
9 class Chunk | 18 class Chunk |
10 { | 19 { |
11 | 20 |
12 public: | 21 public: |
13 | 22 |
14 const static float kWidth; | 23 const static float kWidth; |
15 const static float kHalfWidth; | 24 const static float kHalfWidth; |
16 | 25 |
26 /** | |
27 * Constructor, takes as argument the index of this chunk in the wave | |
28 */ | |
17 Chunk( size_t index ); | 29 Chunk( size_t index ); |
18 | 30 |
31 /** | |
32 * Sets the top value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] | |
33 */ | |
19 void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } | 34 void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } |
35 /** | |
36 * Sets the bottom value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] | |
37 */ | |
20 void inline setBottom(float b) { mAudioBottom = b; mAnimate = 0.0f; mResetting = false; } | 38 void inline setBottom(float b) { mAudioBottom = b; mAnimate = 0.0f; mResetting = false; } |
39 /** | |
40 * Get the top value of this chunk. The value is returned in audio coordinates : [-1.0, 1.0] | |
41 */ | |
21 float inline getTop() const { return mAudioTop; } | 42 float inline getTop() const { return mAudioTop; } |
43 /** | |
44 * Get the bottom value of this chunk. The value is returned in audio coordinates : [-1.0, 1.0] | |
45 */ | |
22 float inline getBottom() const { return mAudioBottom; } | 46 float inline getBottom() const { return mAudioBottom; } |
23 | 47 |
48 /** | |
49 * Reset this chunks. When a chunk is reset it starts shrinking until it disappears. | |
50 * | |
51 */ | |
24 void reset(){ | 52 void reset(){ |
25 mResetting = true; | 53 mResetting = true; |
26 } | 54 } |
27 | 55 |
56 /** | |
57 * Called in the graphic loop. It update this chunk. | |
58 */ | |
28 void update( const DrawInfo& di ); | 59 void update( const DrawInfo& di ); |
29 | 60 |
61 /** | |
62 * Called in the graphic loop. It draws this chunk. | |
63 */ | |
30 void draw( const DrawInfo& di, ci::gl::BatchRef &batch ); | 64 void draw( const DrawInfo& di, ci::gl::BatchRef &batch ); |
31 | 65 |
66 /** | |
67 * Called in the graphic loop. It draws this chunk all the way to the bottom of the screen. | |
68 * This method is called when the chunk is the first or last in a selection. | |
69 */ | |
32 void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); | 70 void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); |
33 | 71 |
72 /** | |
73 * Informs this chunk that it's the first chunk of the selection. | |
74 */ | |
34 void setAsSelectionStart(bool start){ | 75 void setAsSelectionStart(bool start){ |
35 isSelectionStart = start; | 76 isSelectionStart = start; |
36 } | 77 } |
37 | 78 |
79 /** | |
80 * Informs this chunk that it's the last chunk of the selection. | |
81 */ | |
38 void setAsSelectionEnd(bool end){ | 82 void setAsSelectionEnd(bool end){ |
39 isSelectionEnd = end; | 83 isSelectionEnd = end; |
40 } | 84 } |
41 | 85 |
42 private: | 86 private: |