From f84d120dc37704b42b184157b7cad6ad411da2e1 Mon Sep 17 00:00:00 2001
From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es>
Date: Wed, 30 Sep 2015 02:18:05 +0200
Subject: [PATCH] Include full word on TTL messages

---
 Source/Processors/SourceNode/SourceNode.cpp | 20 +++++++++++++-------
 Source/Processors/SourceNode/SourceNode.h   |  6 ++++--
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/Source/Processors/SourceNode/SourceNode.cpp b/Source/Processors/SourceNode/SourceNode.cpp
index 5f0e3947c..9d7a300f3 100755
--- a/Source/Processors/SourceNode/SourceNode.cpp
+++ b/Source/Processors/SourceNode/SourceNode.cpp
@@ -67,7 +67,8 @@ SourceNode::SourceNode(const String& name_)
         }
 
         numEventChannels = dataThread->getNumEventChannels();
-        eventChannelState = new int[numEventChannels];
+        //eventChannelState = new int[numEventChannels];
+		eventChannelState.malloc(numEventChannels);
         for (int i = 0; i < numEventChannels; i++)
         {
             eventChannelState[i] = 0;
@@ -77,7 +78,7 @@ SourceNode::SourceNode(const String& name_)
     else
     {
         enabledState(false);
-        eventChannelState = 0;
+     //   eventChannelState = 0;
         numEventChannels = 0;
     }
 
@@ -85,7 +86,8 @@ SourceNode::SourceNode(const String& name_)
     startTimer(sourceCheckInterval);
 
     timestamp = 0;
-    eventCodeBuffer = new uint64[10000]; //10000 samples per buffer max?
+    //eventCodeBuffer = new uint64[10000]; //10000 samples per buffer max?
+	eventCodeBuffer.malloc(10000);
 
 
 }
@@ -100,8 +102,8 @@ SourceNode::~SourceNode()
     }
 
 
-    if (eventChannelState)
-        delete[] eventChannelState;
+    //if (eventChannelState)
+    //    delete[] eventChannelState;
 }
 
 DataThread* SourceNode::getThread()
@@ -412,7 +414,9 @@ void SourceNode::process(AudioSampleBuffer& buffer,
                              TTL,    // eventType
                              i,      // sampleNum
                              0,	     // eventID
-                             c		 // eventChannel
+                             c,		 // eventChannel
+							 8,
+							 (uint8*)(&eventCodeBuffer[i])
                             );
                 }
                 else
@@ -426,7 +430,9 @@ void SourceNode::process(AudioSampleBuffer& buffer,
                              TTL,    // eventType
                              i,      // sampleNum
                              1,		 // eventID
-                             c		 // eventChannel
+                             c,		 // eventChannel
+							 8,
+							 (uint8*)(&eventCodeBuffer[i])
                             );
 
 
diff --git a/Source/Processors/SourceNode/SourceNode.h b/Source/Processors/SourceNode/SourceNode.h
index 8a98cf74f..8829c2857 100755
--- a/Source/Processors/SourceNode/SourceNode.h
+++ b/Source/Processors/SourceNode/SourceNode.h
@@ -118,8 +118,10 @@ private:
     DataBuffer* inputBuffer;
 
     uint64 timestamp;
-    uint64* eventCodeBuffer;
-    int* eventChannelState;
+    //uint64* eventCodeBuffer;
+    //int* eventChannelState;
+	HeapBlock<uint64> eventCodeBuffer;
+	HeapBlock<int> eventChannelState;
 
     int ttlState;
 
-- 
GitLab