Skip to content
Snippets Groups Projects
Commit aa795a31 authored by Aaron Cuevas Lopez's avatar Aaron Cuevas Lopez
Browse files

Add common processor mapping to the RecordEngines

parent 1dd9ab9e
Branches
Tags
No related merge requests found
Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Debug|x64 = Debug|x64
Debug64|Win32 = Debug64|Win32
Debug64|x64 = Debug64|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Release64|Win32 = Release64|Win32
Release64|x64 = Release64|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64
EndGlobalSection
......
......@@ -71,9 +71,10 @@ void RecordEngine::updateTimestamps(const Array<int64>& ts, int channel)
timestamps.set(channel, ts[channel]);
}
void RecordEngine::setChannelMapping(const Array<int>& chans)
void RecordEngine::setChannelMapping(const Array<int>& chans, const OwnedArray<RecordProcessorInfo>& processors)
{
channelMap = chans;
recordProcessors.swapWith(processors);
}
int64 RecordEngine::getTimestamp(int channel) const
......
......@@ -50,6 +50,12 @@ struct SpikeRecordInfo
int recordIndex;
};
struct RecordProcessorInfo
{
int processorId;
Array<int> recordedChannels; //Indexes of the recorded channels. From 0-maxRecordChannels, not 0-totalChannels
};
struct EngineParameter;
class RecordNode;
class RecordEngineManager;
......@@ -149,7 +155,7 @@ public:
/** Called prior to opening files, to set the map between recorded
channels and actual channel numbers
*/
void setChannelMapping(const Array<int>& channels);
void setChannelMapping(const Array<int>& channels, const OwnedArray<RecordProcessorInfo>& processors);
/** Called after all channels and spike groups have been registered,
just before acquisition starts
......@@ -199,6 +205,7 @@ private:
Array<int64> timestamps;
Array<int> channelMap;
RecordEngineManager* manager;
OwnedArray<RecordProcessorInfo> recordProcessors;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(RecordEngine);
};
......
......@@ -307,16 +307,31 @@ void RecordNode::setParameter(int parameterIndex, float newValue)
channelMap.clear();
int totChans = channelPointers.size();
OwnedArray<RecordProcessorInfo> procInfo;
int lastProcessor = -1;
for (int ch = 0; ch < totChans; ++ch)
{
if (channelPointers[ch]->getRecordState())
Channel* chan = channelPointers[ch];
if (chan->getRecordState())
{
channelMap.add(ch);
//This is bassed on the assumption that all channels from the same processor are added contiguously
//If this behaviour changes, this check should be most thorough
if (chan->nodeId != lastProcessor)
{
lastProcessor = chan->nodeId;
RecordProcessorInfo* pi = new RecordProcessorInfo();
pi->processorId = chan->nodeId;
procInfo.add(pi);
}
procInfo.getLast()->recordedChannels.add(channelMap.size());
}
}
std::cout << "Num Recording Processors: " << procInfo.size() << std::endl;
int numRecordedChannels = channelMap.size();
EVERY_ENGINE->setChannelMapping(channelMap);
//WARNING: If at some point we record at more that one recordEngine at once, we should change this, as using OwnedArrays only works for the first
EVERY_ENGINE->setChannelMapping(channelMap, procInfo);
m_recordThread->setChannelMap(channelMap);
m_dataQueue->setChannels(numRecordedChannels);
m_eventQueue->reset();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment