comparison HeresyBigBangDone/application.macosx/source/DrawingStuff.pde @ 50:f4c6999ecfe9 tip

added the files on my computer that aren't aiff s> these shoudl be everything for the big bang fair 2011 - heresy, and tim's file's also here
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Sat, 08 Oct 2011 22:12:49 +0100
parents
children
comparison
equal deleted inserted replaced
49:0eeda0223db3 50:f4c6999ecfe9
1 //-------------------------------------------------------------------------------------------------------------------------------
2
3 void drawNotes(){ // places the note display grid into the apropriate screen positions
4 int loopsOnScreen = ((width-playArea) / tracks[trSelected].loopLength) + 1;
5 if (loopsOnScreen > currentPulse / tracks[trSelected].loopLength)
6 loopsOnScreen = currentPulse / tracks[trSelected].loopLength;
7 for (int i = 0; i <= loopsOnScreen; i++)
8 image (imgNotes, (width-playArea-(i*tracks[trSelected].loopLength))-currentPulse%(tracks[trSelected].loopLength),0);
9 }
10
11
12
13 //-------------------------------------------------------------------------------------------------------------------------------
14
15 public void pulseFrame(int frameNo){ // Draws a pulsing line at left hand side of the input area when loop restarts
16 strokeWeight(3);
17 if (currentPulse % (tracks[trSelected].loopLength) == 0 || (currentPulse-1) % (tracks[trSelected].loopLength) == 0 || (currentPulse-2) % (tracks[trSelected].loopLength) == 0)
18 stroke(255,255,255);
19 else
20 stroke(255,111,111);
21 line (width-playArea+3, 1, width-playArea+3, 300);
22 }
23
24
25 //-------------------------------------------------------------------------------------------------------------------------------
26
27 void drawTempImageGrid(){ // draws the note display image grid
28 imgNotes.stroke(209,137,255);
29 imgNotes.strokeWeight(15);
30 for(int i = 0; i < 16; i++){
31 if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
32 imgNotes.beginDraw();
33 imgNotes.line (currentPulse%(tracks[trSelected].loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(tracks[trSelected].loopLength)+1, i*imageHeight/16+imageHeight/32);
34 imgNotes.endDraw();
35 displayNoteOnArray[i] = true;
36 }
37 if (tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity == 0){
38 displayNoteOnArray[i] = false;
39 }
40
41 if(trSelected ==0){
42 if ((chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
43 imgNotes.beginDraw();
44 imgNotes.line (currentPulse%(chordsTemp.loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(chordsTemp.loopLength)+1, i*imageHeight/16+imageHeight/32);
45 imgNotes.endDraw();
46 displayNoteOnArray[i] = true;
47 }
48 if (chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0){
49 displayNoteOnArray[i] = false;
50 }
51 }
52 }
53 }
54
55
56 //-------------------------------------------------------------------------------------------------------------------------------
57
58 public void drawLines(){ // draws beat lines
59 int linePosition = 1;
60 int i = 0;
61 for (; linePosition <= imageWidth;){
62 linePosition = i * grid;
63 img.beginDraw();
64 img.stroke(lineColour);
65 img.strokeWeight(2);
66 img.line (linePosition, 0, linePosition, imageHeight);
67 img.endDraw();
68 i++;
69 }
70 }
71
72
73 //-------------------------------------------------------------------------------------------------------------------------------
74
75 public void drawBarLines(){ // draws bar lines
76 int linePosition = 1;
77 for (int i = 0; linePosition <= imageWidth;){
78 linePosition = i * grid * beatsPerBar;
79 img.beginDraw();
80 img.stroke(barLineColour);
81 img.strokeWeight(2);
82 img.line (linePosition, 0, linePosition, imageHeight);
83 img.endDraw();
84 i++;
85 }
86 }
87
88
89 //-------------------------------------------------------------------------------------------------------------------------------
90
91 public void backgroundColour(){ // sets background colour
92 img.beginDraw();
93 img.background (backGround);
94 img.endDraw();
95 }
96
97
98
99 //-------------------------------------------------------------------------------------------------------------------------------
100
101 public void createNoteFan(){ // creates the input fan
102 if (rpulseup)
103 rpulse++;
104 else rpulse--;
105 if (rpulse == grid)
106 rpulseup = false;
107 if (rpulse < 1)
108 rpulseup = true;
109 imgNoteFan.beginDraw();
110 imgNoteFan.stroke(rpulse/grid*255,50,50);
111 imgNoteFan.strokeWeight(1);
112 for (int i = 0; i < 16; i++){
113 if (!chordSelecter)
114 if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){
115 imgNoteFan.fill(209,137,255);
116 }
117 else
118 imgNoteFan.fill(0,0,0);
119 else
120 if (i == 14 || i == 12 || i == 9 || i == 7 || i == 5 || i == 3 || i == 2 || i == 1 || i == 0)
121 imgNoteFan.fill(0,0,0);
122 else
123 imgNoteFan.fill(255,255,255);
124 imgNoteFan.quad(0, i*(imageHeight/16.0), 0, (i+1)*(imageHeight/16.0), fanWidth, (imageHeight/2.0), fanWidth, (imageHeight/2.0));
125 }
126
127 imgNoteFan.endDraw();
128
129 }
130
131 //-------------------------------------------------------------------------------------------------------------------------------
132
133 void calcColours(){ // sets up colour values for background, bar and beat lines
134
135 if(heresyChordChanged){
136
137 if(currentChord == 0){
138 redC = 0;
139 greenC = 0;
140 blueC = 0;
141 }
142
143 if(currentChord == 1){
144 redC = 90;
145 greenC = 76;
146 blueC = 3;
147 }
148
149 if(currentChord == 2){
150 redC = 254;
151 greenC = 255;
152 blueC = 18;
153 }
154
155 if(currentChord == 3){
156 redC = 0;
157 greenC = 0;
158 blueC = 0;
159 }
160
161 if(currentChord == 4){
162 redC = 136;
163 greenC = 245;
164 blueC = 49;
165 }
166
167 if(currentChord == 5){
168 redC = 9;
169 greenC = 18;
170 blueC = 232;
171 }
172
173 if(currentChord == 6){
174 redC = 99;
175 greenC = 99;
176 blueC = 100;
177 }
178
179 if(currentChord == 7){
180 redC = 255;
181 greenC = 166;
182 blueC = 21;
183 }
184
185 if(currentChord == 8){
186 redC = 13;
187 greenC = 79;
188 blueC = 147;
189 }
190
191 if(currentChord == 9){
192 redC = 255;
193 greenC = 165;
194 blueC = 165;
195 }
196
197 if(currentChord == 10){
198 redC = 89;
199 greenC = 110;
200 blueC = 134;
201 }
202
203 if(currentChord == 11){
204 redC = 68;
205 greenC = 242;
206 blueC = 250;
207 }
208
209 backGround = color(redC, greenC, blueC);
210 lineColour = color((redC + 100) % 255,(greenC + 69) % 255,(blueC + 214) % 255);
211 barLineColour = color((redC + 205) % 255, (greenC + 174) % 255, (blueC + 159) % 255);
212
213 backgroundColour();
214 drawLines();
215 drawBarLines();
216 }
217 }
218
219
220
221