From 6980891b32389ec104d218cc5d50ab05d551c9c3 Mon Sep 17 00:00:00 2001
From: Jonas Blumer <jonas.blumer@entwicklungspark.com>
Date: Thu, 17 Dec 2015 11:43:07 +0100
Subject: [PATCH] fixed timing issues

---
 app.js           | 6 ++++--
 public/client.js | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app.js b/app.js
index a72dc9e..1710eb6 100644
--- a/app.js
+++ b/app.js
@@ -7,10 +7,12 @@ var port = (process.env.PORT || 5000);
 var bpm = 120;
 var stepPos = 0;
 
+var noteSpeedVal = 4; // quarternote
+
 var metronome = null;
 metronome = setInterval(function(){ 
                 io.sockets.emit('metronome', getStepPos());
-              }, (60000 / bpm)/4);
+              }, (60000 / bpm)/noteSpeedVal);
 
 
 http.listen(port, function() {
@@ -55,7 +57,7 @@ function generateMetronome(newBpm, oldMetronome){
   
   return setInterval(function(){ 
                 io.sockets.emit('metronome', getStepPos());
-              }, (60000 / newBpm)/4);
+              }, (60000 / newBpm)/noteSpeedVal);
 
 
 }
diff --git a/public/client.js b/public/client.js
index af36f35..94b68cc 100644
--- a/public/client.js
+++ b/public/client.js
@@ -18,6 +18,7 @@ $(function(){
 
     // metronome
     iosocket.on('metronome', function(serverStepPos){
+        console.log('tick');
         stepPos = serverStepPos;
         advanceStep(stepPos);
         playExternalSound();
-- 
GitLab