Corrected web ui to be compatible with the new ODAS system
authorCedric Godin <cedric.godin@me.com>
Wed, 16 Aug 2017 17:11:44 +0000 (13:11 -0400)
committerCedric Godin <cedric.godin@me.com>
Wed, 16 Aug 2017 17:11:44 +0000 (13:11 -0400)
odas_interface/web_interface.ios
ressources/js/graph.js
ressources/js/tcp_link.js

index 78d6cea831e9a8dfe09bfd1e2b813103e37d95b9..8749432f2ca15e866149328f77d60f90cbc9e32b 100644 (file)
@@ -3,8 +3,8 @@
 input:
 {
    
-    raw: { type = "file"; path = "in.raw"; format = "bin16"; }
-    #raw: { type = "soundcard"; card = 3; device = 0; format = "bin16"; }
+#   raw: { type = "file"; path = "in.raw"; format = "bin16"; }
+    raw: { type = "soundcard"; card = 1; device = 0; format = "bin16"; }
 
 };
 
@@ -38,22 +38,22 @@ output:
 
     ssl:
     (
-        { type = "file"; path = "potential.bin"; format = "float"; }
+        { type = "socket"; ip = "127.0.0.1"; port = 9001; format = "json"; }
     );
 
     sst:
     (
-        { type = "file"; path = "tracked.bin"; format = "float"; }
+        { type = "socket"; ip = "127.0.0.1"; port = 9000; format = "json"; }
     );
 
     sss:
     (
-        { type = "file"; path = "separated_stft.bin"; format = "float"; }
+#        { type = "file"; path = "separated_stft.bin"; format = "float"; }
     );
 
     sspf:
     (
-        { type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
+#        { type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
     );
 
-}
\ No newline at end of file
+}
index 20c5e4c50f29692e53dd7cfb4f1eb637362549be..d7b5e463343f4e97a04b8825dd7ed277ae49e00c 100644 (file)
@@ -213,6 +213,13 @@ document.addEventListener('tracking', function(e) {
         framCnt = 0;
         
                dataMax = currentFrame.timestamp;
+        
+        if(currentFrame.ptimestamp) {
+            if(currentFrame.ptimestamp > currentFrame.timestamp) {
+                dataMax = currentFrame.ptimestamp;
+            }
+        }
+        
         charts.forEach(function(bundle) {
                        
             bundle.chart.config.options.scales.xAxes[0].ticks.max = dataMax;
@@ -290,7 +297,14 @@ document.addEventListener('potential', function(e) {
         
         document.dispatchEvent(new Event('request-chart'));
         
-               dataMax = currentFrame.timestamp;
+               dataMax = currentFrame.ptimestamp;
+        
+        if(currentFrame.timestamp) {
+            if(currentFrame.timestamp > currentFrame.ptimestamp) {
+                dataMax = currentFrame.timestamp;
+            }
+        }
+        
         charts.forEach(function(bundle) {
 
             bundle.chart.config.options.scales.xAxes[0].ticks.max = dataMax;
index 310e06d0f9977166e73eb34799db5938fcd98de5..1e42a1c7236252f885d906c65b60d83842ed93b6 100644 (file)
@@ -42,10 +42,12 @@ socket.onmessage = function(msg) {
         return;
     }
     
-    if(Math.abs(data.frame.timestamp -  currentFrame.timestamp) > 1)
-        console.warn('Frame skipped ' + data.frame.timestamp.toString());
+    console.log(data);
+    
+    if(Math.abs(data.timeStamp -  currentFrame.timestamp) > 1)
+        console.warn('Frame skipped ' + data.timeStamp.toString());
 
-    currentFrame.timestamp = data.frame.timestamp;
+    currentFrame.timestamp = data.timeStamp;
 
     var newMap = {};
     var indexPool = [];
@@ -54,9 +56,13 @@ socket.onmessage = function(msg) {
     });
     var hasNewSource = false;
     
-    if(data.frame.src) {    // If frame contains sources
-        
-        data.frame.src.forEach(function(src) {  // Remove still used index from the pool
+    data.src = data.src.filter(function(s) {
+        return s.id !== 0;
+    });
+    
+    if(data.src) {    // If frame contains sources
+
+        data.src.forEach(function(src) {  // Remove still used index from the pool
             
             if(typeof(indexMap[src.id])!='undefined') {  // If source is not new
                 indexPool.splice(indexPool.indexOf(indexMap[src.id]),1);
@@ -64,7 +70,7 @@ socket.onmessage = function(msg) {
             }
         });
         
-        data.frame.src.forEach(function(src) { // Update sources
+        data.src.forEach(function(src) { // Update sources
 
              if(typeof(indexMap[src.id])!='undefined') {  // Source is already registered
 
@@ -135,19 +141,19 @@ potentialSocket.onmessage = function(msg) {
         return;
     }
     
-    if(Math.abs(data.frame.timestamp -  currentFrame.ptimestamp) > 1)
-        console.warn('Frame skipped ' + data.frame.timestamp.toString());
+    if(Math.abs(data.timeStamp -  currentFrame.ptimestamp) > 1)
+        console.warn('Frame skipped ' + data.timeStamp.toString());
 
-    currentFrame.ptimestamp = data.frame.timestamp;
+    currentFrame.ptimestamp = data.timeStamp;
     currentFrame.potentialSources = [];
     
-    if(data.frame.src) {    // If frame contains sources
+    if(data.src) {    // If frame contains sources
         
-        data.frame.src.forEach(function(source) {
+        data.src.forEach(function(source) {
             
             var newSource = new PotentialSource();
             
-            newSource.e = source.e;
+            newSource.e = source.E;
             newSource.x = source.x;
             newSource.y = source.y;
             newSource.z = source.z;