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

Add extra hooks to RecordEngine

parent c10ec93e
No related branches found
No related tags found
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
......
......@@ -44,6 +44,10 @@ void RecordEngine::registerProcessor(const GenericProcessor* processor) {}
void RecordEngine::addChannel(int index, const Channel* chan) {}
void RecordEngine::startChannelBlock() {}
void RecordEngine::endChannelBlock() {}
Channel* RecordEngine::getChannel(int index) const
{
return AccessClass::getProcessorGraph()->getRecordNode()->getDataChannel(index);
......
......@@ -73,10 +73,12 @@ public:
3-(updateTimestamps*)
4-openFiles*
During recording: (RecordThread loop)
1-(updateTimestamps*)
2-writeData*
3-writeEvent* (if needed)
4-writeSpike* (if needed)
1-(updateTimestamps*) (can be called in a per-channel basis when the circular buffer wraps)
2-startChannelBlock*
3-writeData* (per channel. Can be called more than once to account for the circular buffer wrap)
4-endChannelBlock*
4-writeEvent* (if needed)
5-writeSpike* (if needed)
When recording stops:
closeFiles*
......@@ -97,11 +99,19 @@ public:
*/
virtual void closeFiles() = 0;
/** Called by the record thread before it starts writing the channels to disk
*/
virtual void startChannelBlock();
/** Write continuous data for a channel. The raw buffer pointer is passed for speed,
care must be taken to only read the specified number of bytes.
*/
virtual void writeData(int writeChannel, int realChannel, const float* buffer, int size) = 0;
/** Called by the record thread after it has written a channel block
*/
virtual void endChannelBlock();
/** Write a single event to disk.
*/
virtual void writeEvent(int eventType, const MidiMessage& event, int64 timestamp) = 0;
......
......@@ -114,6 +114,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples
Array<CircularBufferIndexes> idx;
m_dataQueue->startRead(idx, timestamps, maxSamples);
EVERY_ENGINE->updateTimestamps(timestamps);
EVERY_ENGINE->startChannelBlock();
for (int chan = 0; chan < m_numChannels; ++chan)
{
if (idx[chan].size1 > 0)
......@@ -128,6 +129,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples
}
}
m_dataQueue->stopRead();
EVERY_ENGINE->endChannelBlock();
std::vector<EventMessagePtr> events;
int nEvents = m_eventQueue->getEvents(events, maxEvents);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment