summary refs log tree commit diff
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2014-10-19 10:28:40 +0200
committermanuroe <manu@matrix.org>2014-10-19 10:28:40 +0200
commit1d6621c31c02f3066f751bbb17cd62f05550b087 (patch)
treee7dc618bb0fe77ef5b0ef995cf30679b7f93f64e
parentfiddle log function (diff)
downloadsynapse-1d6621c31c02f3066f751bbb17cd62f05550b087.tar.xz
Code for the video demo:
Fixed log duration. Renable partition multilines
-rw-r--r--webclient/components/matrix/event-stream-service.js2
-rw-r--r--webclient/components/matrix/midi-event-handler.js25
2 files changed, 16 insertions, 11 deletions
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js
index aa58750d0b..1bc577ffa8 100644
--- a/webclient/components/matrix/event-stream-service.js
+++ b/webclient/components/matrix/event-stream-service.js
@@ -107,7 +107,7 @@ angular.module('eventStreamService', [])
         // Initial sync: get all information and the last 30 messages of all rooms of the user
         // 30 messages should be enough to display a full page of messages in a room
         // without requiring to make an additional request
-        matrixService.initialSync(10000, false).then(
+        matrixService.initialSync(1, false).then(
             function(response) {
                 var rooms = response.data.rooms;
                 for (var i = 0; i < rooms.length; ++i) {
diff --git a/webclient/components/matrix/midi-event-handler.js b/webclient/components/matrix/midi-event-handler.js
index dcbca494e9..efc8421390 100644
--- a/webclient/components/matrix/midi-event-handler.js
+++ b/webclient/components/matrix/midi-event-handler.js
@@ -87,7 +87,7 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
     
     getLogDuration: function(duration) {
         var fraction =  duration / this.beat;
-        console.log(fraction);
+        //console.log(fraction);
 
         // log2(4) = 2  # 4 beats == whole bar == w
         // log2(2) = 1  # 2 beats == half = h
@@ -101,26 +101,26 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
         var logDuration = this.getLogDuration(duration);
         var trashIt = false; // Flag to ignore artefact(???)
         switch (logDuration) {
-            case 4:
+            case 2:
                 musicFraction = "w";
                 break;
-            case 2:
+            case 1:
                 musicFraction = "h";
                 break;
-            case 1:
+            case 0:
                 musicFraction = "q";
                 break;
-/*          // quantise to quavers for now
-            case 0:
+          // quantise to quavers for now
+            case -1:
                 musicFraction = "8";
                 break;
-            case -1:
+            case -2:
                 musicFraction = "16";
                 break;
-            case -2:
+            case -3:
                 musicFraction = "32";
                 break;
-*/
+
             default:
                 console.log("## Ignored note");
                 // Too short, ignore it
@@ -130,6 +130,8 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
 
         // Matthew is about to fix it 
         if (trashIt) return;
+        
+        this.currentMeasureTime += duration / this.beat;
 
         var s = ":" + musicFraction + " ";
         
@@ -202,7 +204,10 @@ notes C-D-E/4 #0# =:: C-D-E-F/4 =|=");
 
                 // check if it's been so long since the last note that we should do a rest.
                 var logDuration = this.getLogDuration(midi_ts - this.chord.end_midi_ts);
-                if (logDuration >= -2) {
+                
+                //console.log((midi_ts - this.chord.end_midi_ts) + " -> " + logDuration);
+                
+                if (logDuration >= 1) {
                     this.renderChord(midi_ts - this.chord.end_midi_ts, true);
                 }