Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/include/Chunk.h @ 5:75b744078d66
added license
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Wed, 13 Jul 2016 16:06:46 +0200 |
parents | dd889fff8423 |
children | 4dad0b810f18 |
comparison
equal
deleted
inserted
replaced
4:ab6db404403a | 5:75b744078d66 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 2015 Fiore Martin | |
4 Copyright (C) 2016 Queen Mary University of London | |
5 Author: Fiore Martin | |
6 | |
7 This file is part of Collidoscope. | |
8 | |
9 Collidoscope is free software: you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation, either version 3 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
1 | 24 |
2 #pragma once | 25 #pragma once |
3 | 26 |
4 #include "cinder/Color.h" | 27 #include "cinder/Color.h" |
5 #include "cinder/gl/Batch.h" | 28 #include "cinder/gl/Batch.h" |
24 const static float kHalfWidth; | 47 const static float kHalfWidth; |
25 | 48 |
26 /** | 49 /** |
27 * Constructor, takes as argument the index of this chunk in the wave | 50 * Constructor, takes as argument the index of this chunk in the wave |
28 */ | 51 */ |
29 Chunk( size_t index ); | 52 Chunk( size_t index ); |
30 | 53 |
31 /** | 54 /** |
32 * Sets the top value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] | 55 * Sets the top value of this chunk. The value is passed in audio coordinates : [-1.0, 1.0] |
33 */ | 56 */ |
34 void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } | 57 void inline setTop(float t) { mAudioTop = t; mAnimate = 0.0f; mResetting = false; /* startes the animation to crate a chunk */ } |
47 | 70 |
48 /** | 71 /** |
49 * Reset this chunks. When a chunk is reset it starts shrinking until it disappears. | 72 * Reset this chunks. When a chunk is reset it starts shrinking until it disappears. |
50 * | 73 * |
51 */ | 74 */ |
52 void reset(){ | 75 void reset(){ |
53 mResetting = true; | 76 mResetting = true; |
54 } | 77 } |
55 | 78 |
56 /** | 79 /** |
57 * Called in the graphic loop. It update this chunk. | 80 * Called in the graphic loop. It update this chunk. |
58 */ | 81 */ |
59 void update( const DrawInfo& di ); | 82 void update( const DrawInfo& di ); |
70 void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); | 93 void drawBar( const DrawInfo& di, ci::gl::BatchRef &batch ); |
71 | 94 |
72 /** | 95 /** |
73 * Informs this chunk that it's the first chunk of the selection. | 96 * Informs this chunk that it's the first chunk of the selection. |
74 */ | 97 */ |
75 void setAsSelectionStart(bool start){ | 98 void setAsSelectionStart(bool start){ |
76 isSelectionStart = start; | 99 isSelectionStart = start; |
77 } | 100 } |
78 | 101 |
79 /** | 102 /** |
80 * Informs this chunk that it's the last chunk of the selection. | 103 * Informs this chunk that it's the last chunk of the selection. |
81 */ | 104 */ |
82 void setAsSelectionEnd(bool end){ | 105 void setAsSelectionEnd(bool end){ |
83 isSelectionEnd = end; | 106 isSelectionEnd = end; |
84 } | 107 } |
85 | 108 |
86 private: | 109 private: |
87 | 110 |
88 float mAudioTop; | 111 float mAudioTop; |
89 float mAudioBottom; | 112 float mAudioBottom; |