Mercurial > hg > movesynth
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HeresyBigBangDone/application.macosx/source/DrawingStuff.pde Sat Oct 08 22:12:49 2011 +0100 @@ -0,0 +1,221 @@ +//------------------------------------------------------------------------------------------------------------------------------- + +void drawNotes(){ // places the note display grid into the apropriate screen positions + int loopsOnScreen = ((width-playArea) / tracks[trSelected].loopLength) + 1; + if (loopsOnScreen > currentPulse / tracks[trSelected].loopLength) + loopsOnScreen = currentPulse / tracks[trSelected].loopLength; + for (int i = 0; i <= loopsOnScreen; i++) + image (imgNotes, (width-playArea-(i*tracks[trSelected].loopLength))-currentPulse%(tracks[trSelected].loopLength),0); + } + + + +//------------------------------------------------------------------------------------------------------------------------------- + +public void pulseFrame(int frameNo){ // Draws a pulsing line at left hand side of the input area when loop restarts + strokeWeight(3); + if (currentPulse % (tracks[trSelected].loopLength) == 0 || (currentPulse-1) % (tracks[trSelected].loopLength) == 0 || (currentPulse-2) % (tracks[trSelected].loopLength) == 0) + stroke(255,255,255); + else + stroke(255,111,111); + line (width-playArea+3, 1, width-playArea+3, 300); +} + + +//------------------------------------------------------------------------------------------------------------------------------- + +void drawTempImageGrid(){ // draws the note display image grid + imgNotes.stroke(209,137,255); + imgNotes.strokeWeight(15); + for(int i = 0; i < 16; i++){ + if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ + imgNotes.beginDraw(); + imgNotes.line (currentPulse%(tracks[trSelected].loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(tracks[trSelected].loopLength)+1, i*imageHeight/16+imageHeight/32); + imgNotes.endDraw(); + displayNoteOnArray[i] = true; + } + if (tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity == 0){ + displayNoteOnArray[i] = false; + } + + if(trSelected ==0){ + if ((chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ + imgNotes.beginDraw(); + imgNotes.line (currentPulse%(chordsTemp.loopLength), i*imageHeight/16+imageHeight/32, currentPulse%(chordsTemp.loopLength)+1, i*imageHeight/16+imageHeight/32); + imgNotes.endDraw(); + displayNoteOnArray[i] = true; + } + if (chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)] != null && chordsTemp.sequence[i][currentPulse%(chordsTemp.loopLength)].noteVelocity == 0){ + displayNoteOnArray[i] = false; + } + } + } +} + + +//------------------------------------------------------------------------------------------------------------------------------- + +public void drawLines(){ // draws beat lines + int linePosition = 1; + int i = 0; + for (; linePosition <= imageWidth;){ + linePosition = i * grid; + img.beginDraw(); + img.stroke(lineColour); + img.strokeWeight(2); + img.line (linePosition, 0, linePosition, imageHeight); + img.endDraw(); + i++; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------- + +public void drawBarLines(){ // draws bar lines + int linePosition = 1; + for (int i = 0; linePosition <= imageWidth;){ + linePosition = i * grid * beatsPerBar; + img.beginDraw(); + img.stroke(barLineColour); + img.strokeWeight(2); + img.line (linePosition, 0, linePosition, imageHeight); + img.endDraw(); + i++; + } +} + + +//------------------------------------------------------------------------------------------------------------------------------- + +public void backgroundColour(){ // sets background colour + img.beginDraw(); + img.background (backGround); + img.endDraw(); +} + + + +//------------------------------------------------------------------------------------------------------------------------------- + +public void createNoteFan(){ // creates the input fan + if (rpulseup) + rpulse++; + else rpulse--; + if (rpulse == grid) + rpulseup = false; + if (rpulse < 1) + rpulseup = true; + imgNoteFan.beginDraw(); + imgNoteFan.stroke(rpulse/grid*255,50,50); + imgNoteFan.strokeWeight(1); + for (int i = 0; i < 16; i++){ + if (!chordSelecter) + if ((tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)] != null && tracks[trSelected].sequence[i][currentPulse%(tracks[trSelected].loopLength)].noteVelocity > 0) || displayNoteOnArray[i]){ + imgNoteFan.fill(209,137,255); + } + else + imgNoteFan.fill(0,0,0); + else + if (i == 14 || i == 12 || i == 9 || i == 7 || i == 5 || i == 3 || i == 2 || i == 1 || i == 0) + imgNoteFan.fill(0,0,0); + else + imgNoteFan.fill(255,255,255); + imgNoteFan.quad(0, i*(imageHeight/16.0), 0, (i+1)*(imageHeight/16.0), fanWidth, (imageHeight/2.0), fanWidth, (imageHeight/2.0)); + } + + imgNoteFan.endDraw(); + +} + +//------------------------------------------------------------------------------------------------------------------------------- + +void calcColours(){ // sets up colour values for background, bar and beat lines + + if(heresyChordChanged){ + + if(currentChord == 0){ + redC = 0; + greenC = 0; + blueC = 0; + } + + if(currentChord == 1){ + redC = 90; + greenC = 76; + blueC = 3; + } + + if(currentChord == 2){ + redC = 254; + greenC = 255; + blueC = 18; + } + + if(currentChord == 3){ + redC = 0; + greenC = 0; + blueC = 0; + } + + if(currentChord == 4){ + redC = 136; + greenC = 245; + blueC = 49; + } + + if(currentChord == 5){ + redC = 9; + greenC = 18; + blueC = 232; + } + + if(currentChord == 6){ + redC = 99; + greenC = 99; + blueC = 100; + } + + if(currentChord == 7){ + redC = 255; + greenC = 166; + blueC = 21; + } + + if(currentChord == 8){ + redC = 13; + greenC = 79; + blueC = 147; + } + + if(currentChord == 9){ + redC = 255; + greenC = 165; + blueC = 165; + } + + if(currentChord == 10){ + redC = 89; + greenC = 110; + blueC = 134; + } + + if(currentChord == 11){ + redC = 68; + greenC = 242; + blueC = 250; + } + + backGround = color(redC, greenC, blueC); + lineColour = color((redC + 100) % 255,(greenC + 69) % 255,(blueC + 214) % 255); + barLineColour = color((redC + 205) % 255, (greenC + 174) % 255, (blueC + 159) % 255); + + backgroundColour(); + drawLines(); + drawBarLines(); + } +} + + + +