--- a/client/app/app.css Tue Oct 14 16:24:49 2014 +0200
+++ b/client/app/app.css Tue Oct 14 18:00:13 2014 +0200
@@ -34,7 +34,7 @@
overflow: hidden;
padding-bottom: 32%;
position: relative;
- width: 47%;
+ width: 45%;
}
.mons-button .content{
box-sizing: content-box;
--- a/pianoroll/app.js Tue Oct 14 16:24:49 2014 +0200
+++ b/pianoroll/app.js Tue Oct 14 18:00:13 2014 +0200
@@ -1,13 +1,5 @@
-var sock = null;
-var ellog = null;
-
-
-function log(m) {
- ellog.innerHTML += m + '\n';
- ellog.scrollTop = ellog.scrollHeight;
-};
-
// Config vars
+var logger = false;
var sceneWidth = 1920;
//var sceneHeight = 128 * 4; // multiple of 128 because of 128 levels in midi signals -> better look
var prHeight1 = 435;
@@ -15,8 +7,9 @@
var sceneHeight = prHeight1 + prHeight2;
var sceneBgColor = 0xFFFFFF;
var lineColor = 0x444444;
-var manualFramerate = 24;
+//var manualFramerate = 24;
var pixelsPerSecond1 = Math.floor(sceneWidth / 30); // nb of pixels per second
+var manualFramerate = pixelsPerSecond1 / 4;
var pixelsPerSecond2 = Math.floor(sceneWidth / 60); // nb of pixels per second
var lineInterval = 5000; // means line every 5 seconds
var nbLines = -1;
@@ -77,7 +70,7 @@
}
var uberContainer = new PIXI.DisplayObjectContainer();
-uberContainer.position.x = Math.floor(sceneWidth*4/5);
+uberContainer.position.x = Math.floor(sceneWidth*9/10);
uberContainer.position.y = 0;
stage.addChild(uberContainer);
@@ -147,9 +140,23 @@
}
}
+// Socket management
+var sock = null;
+var ellog = null;
+function log(m) {
+ if(logger){
+ ellog.innerHTML += m + '\n';
+ ellog.scrollTop = ellog.scrollHeight;
+ }
+}
window.onload = function() {
- ellog = document.getElementById('log');
+ if(logger){
+ ellog = document.getElementById('log');
+ }
+ else{
+ document.body.removeChild(document.getElementById('log'));
+ }
var wsuri;
if (window.location.protocol === "file:") {
@@ -168,16 +175,22 @@
if (sock) {
sock.onopen = function() {
- log("Connected to " + wsuri);
+ if(logger){
+ log("Connected to " + wsuri);
+ }
}
sock.onclose = function(e) {
- log("Connection closed (wasClean = " + e.wasClean + ", code = " + e.code + ", reason = '" + e.reason + "')");
+ if(logger){
+ log("Connection closed (wasClean = " + e.wasClean + ", code = " + e.code + ", reason = '" + e.reason + "')");
+ }
sock = null;
}
sock.onmessage = function(e) {
- log("Got message: " + e.data);
+ if(logger){
+ log("Got message: " + e.data);
+ }
addBunny(JSON.parse(e.data));
}
}
@@ -221,8 +234,20 @@
container2.addChild(t);
}
+addLine();
var moveInterval = window.setInterval(moveContainer, 1000/manualFramerate);
var verticalLinesInterval = false;
if(drawVerticalLines){
verticalLinesInterval = window.setInterval(addLine, lineInterval);
}
+var nbSec = 0;
+var mySpan = document.getElementById("myspan");
+function updateTime(){
+ nbSec++;
+ var hours = parseInt( nbSec / 3600 ) % 24;
+ var minutes = parseInt( nbSec / 60 ) % 60;
+ var seconds = nbSec % 60;
+ var timeStr = (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds);
+ mySpan.innerHTML = timeStr;
+}
+var secondInterval = window.setInterval(updateTime, 1000);
--- a/pianoroll/pianoroll.html Tue Oct 14 16:24:49 2014 +0200
+++ b/pianoroll/pianoroll.html Tue Oct 14 18:00:13 2014 +0200
@@ -1,5 +1,6 @@
<html>
<head>
+ <meta charset="UTF-8">
<title>Piano Roll with pixi.js</title>
<style>
body {
@@ -18,7 +19,7 @@
<h1>OSC websocket Piano Roll Test</h1>
<noscript>You must enable JavaScript</noscript>
<div id="canvasContainer"></div>
- <p><a href="#" onclick="clearInterval(moveInterval); clearInterval(verticalLinesInterval); return false;">stop intervals</a></p>
+ <p><a href="#" onclick="clearInterval(moveInterval); clearInterval(verticalLinesInterval); return false;">stop intervals</a> - temps écoulé : <span id="myspan"></span></p>
<pre id="log"></pre>
<script src="pixi.js"></script>
<script src="app.js"></script>
--- a/utils/pianoroll-client.py Tue Oct 14 16:24:49 2014 +0200
+++ b/utils/pianoroll-client.py Tue Oct 14 18:00:13 2014 +0200
@@ -37,7 +37,8 @@
tc = 0
for row in self.rows:
row_conv = [ osc.TimeTagArgument(float(row[0]))] + [osc.IntArgument(int(a)) for a in row[1:]]
- time.sleep((row_conv[1].value-tc)/10**3)
+ #time.sleep((row_conv[1].value-tc)/10**3)
+ time.sleep(0.1)
tc = row_conv[1].value
self._send(osc.Message(self.address,*row_conv))
print("Goodbye.")