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