From 612049187f41e4d13199d7a41ab07e8d7fb13488 Mon Sep 17 00:00:00 2001
From: jsiegle <jsiegle@mit.edu>
Date: Sat, 15 Jun 2013 15:45:07 -0400
Subject: [PATCH] ChannelMappingNode works now

---
 Source/Processors/ChannelMappingNode.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/Source/Processors/ChannelMappingNode.cpp b/Source/Processors/ChannelMappingNode.cpp
index 419d4c0c5..4388f0879 100644
--- a/Source/Processors/ChannelMappingNode.cpp
+++ b/Source/Processors/ChannelMappingNode.cpp
@@ -32,6 +32,13 @@ ChannelMappingNode::ChannelMappingNode()
 {
 	referenceArray.resize(1024); // make room for 1024 channels
 	channelArray.resize(1024);
+
+	for (int i = 0; i < referenceArray.size(); i++)
+	{
+		referenceArray.set(i, -1);
+		channelArray.set(i, i);
+	}
+
 }
 
 ChannelMappingNode::~ChannelMappingNode()
@@ -54,6 +61,7 @@ void ChannelMappingNode::updateSettings()
 {
 	if (getNumInputs() > 0)
 		channelBuffer.setSize(getNumInputs(), 10000);
+
 }
 
 
@@ -75,10 +83,10 @@ void ChannelMappingNode::process(AudioSampleBuffer& buffer,
                             int& nSamples)
 {
 
-	// copy everything into the channel buffer
-	channelBuffer.setDataToReferTo(buffer.getArrayOfChannels(), 
-								   buffer.getNumChannels(),
-								   buffer.getNumSamples());
+	// use copy constructor to set the data to refer to
+	channelBuffer = buffer; //.setDataToReferTo(buffer.getArrayOfChannels(), 
+							//	   buffer.getNumChannels(),
+						//		   buffer.getNumSamples());
 
 	// copy it back into the buffer according to the channel mapping
 	buffer.clear();
-- 
GitLab