pianoroll/app.js
changeset 16 3343e89b04a1
parent 15 f1ae020c2872
child 17 4dd9a96a6d3b
--- a/pianoroll/app.js	Mon Oct 13 17:53:00 2014 +0200
+++ b/pianoroll/app.js	Mon Oct 13 18:19:28 2014 +0200
@@ -93,7 +93,6 @@
             var y = (128-note) * sceneHeight / 128; // (128-note) because y = 0 is for note = 128 and y = 128 for note = 0
             graphics.drawRect(beginX, y, width, sceneHeight / 128);
             graphics.endFill();
-            //console.log("diff temporelle = ", x);
             container.addChild(graphics);
             delete noteDict[note];
         }
@@ -144,14 +143,23 @@
     nbLines++;
     var graphics = new PIXI.Graphics();
     var x = nbLines * (lineInterval/1000) * pixelsPerSecond;
-    console.log("nbLines = ",nbLines, "x = ", x);
+    //console.log("nbLines = ",nbLines, "x = ", x);
     graphics.beginFill(0xFFFF00);
     graphics.lineStyle(1, 0x444444);
     graphics.moveTo(x, 0);
     graphics.lineTo(x, sceneHeight);
     graphics.endFill();
-
     container.addChild(graphics);
+    // Add text
+    var totalSec = nbLines * lineInterval / 1000;
+    var hours = parseInt( totalSec / 3600 ) % 24;
+    var minutes = parseInt( totalSec / 60 ) % 60;
+    var seconds = totalSec % 60;
+    var timeStr = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds  < 10 ? "0" + seconds : seconds);
+    var t = new PIXI.Text(timeStr, { font: "10pt Arial", fill: "#444444" });
+    t.x = x + 2;
+    t.y = sceneHeight - 20;
+    container.addChild(t);
 }
 var moveInterval = window.setInterval(moveContainer, 1000/manualFramerate);
 var linesInterval = window.setInterval(addLine, lineInterval);