From f0440ab16c3ac18607a48563166691abe26d8c5e Mon Sep 17 00:00:00 2001
From: Aaron Cuevas Lopez <aacuelo@teleco.upv.es>
Date: Wed, 4 Mar 2015 04:39:59 +0100
Subject: [PATCH] Adapt eCube to new version of sourcenode code

---
 Builds/VisualStudio2013/open-ephys.vcxproj    |  2 +-
 Source/Processors/DataThreads/DataThread.h    |  6 ---
 Source/Processors/DataThreads/EcubeThread.cpp | 51 ++++---------------
 Source/Processors/DataThreads/EcubeThread.h   | 19 ++-----
 4 files changed, 15 insertions(+), 63 deletions(-)

diff --git a/Builds/VisualStudio2013/open-ephys.vcxproj b/Builds/VisualStudio2013/open-ephys.vcxproj
index 9b47cfcec..f0554c20e 100644
--- a/Builds/VisualStudio2013/open-ephys.vcxproj
+++ b/Builds/VisualStudio2013/open-ephys.vcxproj
@@ -87,7 +87,7 @@
       <Optimization>Disabled</Optimization>
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
       <AdditionalIncludeDirectories>..\..\JuceLibraryCode;..\..\JuceLibraryCode\modules;../../Resources/windows-libs/HDF5/include;../../Resources/windows-libs/ZeroMQ/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;_WINDOWS;DEBUG;_DEBUG;NOMINMAX;ZEROMQ;JUCER_VS2013_78A5020=1;JUCE_APP_VERSION=0.3.4;JUCE_APP_VERSION_HEX=0x304;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>ECUBE_COMPILE;WIN32;_WINDOWS;DEBUG;_DEBUG;NOMINMAX;ZEROMQ;JUCER_VS2013_78A5020=1;JUCE_APP_VERSION=0.3.4;JUCE_APP_VERSION_HEX=0x304;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <PrecompiledHeader />
diff --git a/Source/Processors/DataThreads/DataThread.h b/Source/Processors/DataThreads/DataThread.h
index 9696fe955..453b714fb 100755
--- a/Source/Processors/DataThreads/DataThread.h
+++ b/Source/Processors/DataThreads/DataThread.h
@@ -128,12 +128,6 @@ public:
 		return false;
 	}
 
-    /** Returns the number of ADC channels of the data source.*/
-    virtual int getNumADCchannels()
-    {
-        return 0;
-    }
-
     /** Changes the names of channels, if the thread needs custom names. */
 	void updateChannels();
 
diff --git a/Source/Processors/DataThreads/EcubeThread.cpp b/Source/Processors/DataThreads/EcubeThread.cpp
index 45e97cf24..2dc25c20e 100644
--- a/Source/Processors/DataThreads/EcubeThread.cpp
+++ b/Source/Processors/DataThreads/EcubeThread.cpp
@@ -298,7 +298,7 @@ EcubeThread::EcubeThread(SourceNode* sn) : DataThread(sn), numberingScheme(1), a
 
         pDevInt->buf_timestamp_locked = false;
 
-        setDefaultChannelNamesAndType();
+        setDefaultChannelNames();
 
     }
     catch (_com_error& e)
@@ -308,24 +308,11 @@ EcubeThread::EcubeThread(SourceNode* sn) : DataThread(sn), numberingScheme(1), a
     }
 }
 
-void EcubeThread::getChannelsInfo(StringArray &Names_, Array<ChannelType> &type_, Array<int> &stream_, Array<int> &originalChannelNumber_, Array<float> &gains_)
-{
-    Names_ = Names;
-    type_ = type;
-    stream_ = stream;
-    originalChannelNumber_ = originalChannelNumber;
-    gains_ = gains;
-}
-
 /* This will give default names & gains to channels, unless they were manually modified by the user
 In that case, the query channelModified, will return the values that need to be put */
-void EcubeThread::setDefaultChannelNamesAndType()
+void EcubeThread::setDefaultChannelNames()
 {
-    Names.clear();
-    type.clear();
-    stream.clear();
-    gains.clear();
-    originalChannelNumber.clear();
+   
     String prefix;
     ChannelType common_type;
 
@@ -352,31 +339,23 @@ void EcubeThread::setDefaultChannelNamesAndType()
 
     for (int i = 0; i < numch; i++)
     {
-        Names.add(prefix + String(i));
-        gains.add(getBitVolts(i));
-        type.add(common_type);
-        originalChannelNumber.add(i);
+		ChannelCustomInfo ci;
+		ci.name = prefix + String(i);
+		ci.gain = getBitVolts(i);
+		channelInfo.set(i, ci);
     }
 
-    stream.add(0);
 }
 
-void EcubeThread::updateChannelNames()
+bool EcubeThread::usesCustomNames()
 {
-    setDefaultChannelNamesAndType();
-
-    for (int i = 0; i < sn->channels.size(); i++)
-    {
-        sn->channels[i]->setName(Names[i]);
-        sn->channels[i]->bitVolts = gains[i];
-        sn->channels[i]->setType(type[i]);
-    }
+	return true;
 }
 
 void EcubeThread::setDefaultNamingScheme(int scheme)
 {
     numberingScheme = scheme;
-    setDefaultChannelNamesAndType();
+    setDefaultChannelNames();
 }
 
 
@@ -432,16 +411,6 @@ int EcubeThread::getNumEventChannels()
         return 0;
 }
 
-int EcubeThread::getNumADCchannels()
-{
-    if (pDevInt->data_format == EcubeDevInt::dfInterleavedChannelsAnalog)
-        return 32;
-    else if(pDevInt->data_format == EcubeDevInt::dfDigital)
-        return 64;
-    else
-        return 0;
-}
-
 float EcubeThread::getSampleRate()
 {
     return m_samplerate;
diff --git a/Source/Processors/DataThreads/EcubeThread.h b/Source/Processors/DataThreads/EcubeThread.h
index efd9d67bf..d6afc1821 100644
--- a/Source/Processors/DataThreads/EcubeThread.h
+++ b/Source/Processors/DataThreads/EcubeThread.h
@@ -85,9 +85,6 @@ public:
     /** Returns the number of event channels of the data source.*/
     virtual int getNumEventChannels();
 
-    /** Returns the number of ADC channels of the data source.*/
-    virtual int getNumADCchannels();
-
     /** Returns the sample rate of the data source.*/
     virtual float getSampleRate();
 
@@ -96,25 +93,17 @@ public:
 
 	virtual float getBitVolts(Channel* chan);
 
-    virtual void getChannelsInfo(StringArray &Names, Array<ChannelType> &type, Array<int> &stream, Array<int> &originalChannelNumber, Array<float> &gains);
     void setDefaultNamingScheme(int scheme);
-    /** Changes the names of channels, if the thread needs custom names. */
-    virtual void updateChannelNames();
+	
+	bool usesCustomNames();
 
     // Custom thread control functions
     void setSpeakerVolume(double volume);
     void setSpeakerChannel(unsigned short channel);
 
 private:
-    void setDefaultChannelNamesAndType();
-
-    // used for data stream names...
-    int numberingScheme;
-    StringArray Names;
-    Array<ChannelType> type;
-    Array<float> gains;
-    Array<int> stream;
-    Array<int> originalChannelNumber;
+	int numberingScheme;
+    void setDefaultChannelNames();
 
     ScopedPointer<EcubeDevInt> pDevInt;
 
-- 
GitLab