class PitchLayer extends Layer { // La courbe Haut: Pitch PitchLayer(PApplet parent) { super(parent); } void setup() { // textFont(maFonte); smooth(); noStroke(); } void draw() { if (Tete > 0) { // println("IndexPitch = " + IndexPitch + " LignesPitch.length = " + LignesPitch.length); if (IndexPitch < LignesPitch.length) { LignePitch = float(split(LignesPitch[IndexPitch], " ")); if (Float.isNaN(LignePitch[0])) { IndexPitch = IndexPitch + 1; } // println("temps = " + temps + " LignePitch[0] = " + LignePitch[0]); if ((temps > LignePitch[0]) && ! Pause) { xApresPitch = FacteurX * (width) * LignePitch[0] / DureeFichier; // XVertex[IVertex] = width / (formResolution - 2) * IVertex; // XVertex[IVertex] = width / (formResolution - 2) * IVertex; if (IVertex > 100) IVertex = 0; XVertex[formResolution-1] = width / (100) * IVertex; // if (((xAvantPitch % width) > (xApresPitch % width)) && (IndexPitch < LignesPitch.length - 10) ) { if (((xAvantPitch % height) > (xApresPitch % height)) && (IndexPitch < LignesPitch.length - 10) ) { EffaceEcran(); // if (! FlagBlurPitch) background(0, 0, 0, 0); } if (Float.isNaN(LignePitch[1])) { PitchActuel = PitchMini; IndexPitch = IndexPitch + 1; Trace = false; xAvantPitch = xApresPitch; // println("NaN IndexPitch = " + IndexPitch); } else { PitchActuel = LignePitch[1]; yApresPitch = YPitch(PitchActuel) ; // YVertex[IVertex] = yApresPitch; // YVertex[formResolution-1] = yApresPitch - (frameCount/4) + 150; YVertex[formResolution-1] = yApresPitch - ((frameCount - TrameCompteZero)/6) + 280; IVertex = IVertex + 1; if (Trace && ((xAvantPitch % width) > 0) && FlagLigneHaut) { // stroke(255); // Ligne blanche // stroke(150); // Ligne // strokeWeight(EpaisseurCourbe); // strokeWeight(5); // line(xAvantPitch % width, yAvantPitch, xApresPitch % width, yApresPitch); // line(yAvantPitch + 400, height - (xAvantPitch % height), yApresPitch + 400, height - (xApresPitch % height)); // point(yAvantPitch + 400, height - (xAvantPitch % height)); smooth(); noStroke(); fill(255); // ellipse(yAvantPitch + 400, height - (xAvantPitch % height), 3, 3); } xAvantPitch = xApresPitch; yAvantPitch = yApresPitch; Trace = true; IndexPitch = IndexPitch + 1; } } // if (IVertex >= formResolution) { if (true) { //println("IVertex = " + IVertex + " XVertex[formResolution-1] = " + XVertex[formResolution-1]); smooth(); stroke(255, 255); // strokeWeight(0.75); strokeWeight(1); noFill(); // fill(0,0,255,150); beginShape(); // start controlpoint // curveVertex(XVertex[0], YVertex[0]- (frameCount/4) + 150); curveVertex(XVertex[0], YVertex[0]); for (int i=1; i < formResolution; i++) { // curveVertex(XVertex[i], YVertex[i]- (frameCount/4) + 150); // only these points are drawn if (XVertex[i] > XVertex[i-1]) curveVertex(XVertex[i], YVertex[i]); // only these points are drawn } // curveVertex(XVertex[formResolution-1], YVertex[formResolution-1] - (frameCount/4) + 250); // end controlpoint // curveVertex(XVertex[formResolution-1], YVertex[formResolution-1]); // end controlpoint endShape(); for (int i=0; i < (formResolution-1); i++) { XVertex[i] = XVertex[i+1]; YVertex[i] = YVertex[i+1]; } // IVertex = 0; } } else Fin = true; // if ((frameCount % AdjustBlurPitch == 0) & FlagBlurPitch) filter(BLUR, 0.572); // > 0.575 if ((temps > DureeFichier) || (Tete == 0)) { Fin =true; background(0, 0, 0, 0); } } else background(0, 0, 0, 0); } }