Skip to content

Commit 02deb63

Browse files
committed
Add extra hooks to RecordEngine
1 parent c10ec93 commit 02deb63

4 files changed

Lines changed: 35 additions & 9 deletions

File tree

Builds/VisualStudio2013/open-ephys.sln

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
Microsoft Visual Studio Solution File, Format Version 11.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 2013
3-
Project("{5A05F353-1D63-394C-DFB0-981BB2309002}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
3+
VisualStudioVersion = 12.0.40629.0
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "open-ephys", "open-ephys.vcxproj", "{9C924D66-7DEC-1AEF-B375-DB8666BFB909}"
46
EndProject
57
Global
68
GlobalSection(SolutionConfigurationPlatforms) = preSolution
79
Debug|Win32 = Debug|Win32
8-
Release|Win32 = Release|Win32
10+
Debug|x64 = Debug|x64
11+
Debug64|Win32 = Debug64|Win32
912
Debug64|x64 = Debug64|x64
13+
Release|Win32 = Release|Win32
14+
Release|x64 = Release|x64
15+
Release64|Win32 = Release64|Win32
1016
Release64|x64 = Release64|x64
1117
EndGlobalSection
1218
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1319
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.ActiveCfg = Debug|Win32
1420
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|Win32.Build.0 = Debug|Win32
15-
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
16-
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
21+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug|x64.ActiveCfg = Debug|Win32
22+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|Win32.ActiveCfg = Debug64|x64
1723
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.ActiveCfg = Debug64|x64
1824
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Debug64|x64.Build.0 = Debug64|x64
25+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.ActiveCfg = Release|Win32
26+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|Win32.Build.0 = Release|Win32
27+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release|x64.ActiveCfg = Release|Win32
28+
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|Win32.ActiveCfg = Release64|x64
1929
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.ActiveCfg = Release64|x64
2030
{9C924D66-7DEC-1AEF-B375-DB8666BFB909}.Release64|x64.Build.0 = Release64|x64
2131
EndGlobalSection

Source/Processors/RecordNode/RecordEngine.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ void RecordEngine::registerProcessor(const GenericProcessor* processor) {}
4444

4545
void RecordEngine::addChannel(int index, const Channel* chan) {}
4646

47+
void RecordEngine::startChannelBlock() {}
48+
49+
void RecordEngine::endChannelBlock() {}
50+
4751
Channel* RecordEngine::getChannel(int index) const
4852
{
4953
return AccessClass::getProcessorGraph()->getRecordNode()->getDataChannel(index);

Source/Processors/RecordNode/RecordEngine.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ class PLUGIN_API RecordEngine
7373
3-(updateTimestamps*)
7474
4-openFiles*
7575
During recording: (RecordThread loop)
76-
1-(updateTimestamps*)
77-
2-writeData*
78-
3-writeEvent* (if needed)
79-
4-writeSpike* (if needed)
76+
1-(updateTimestamps*) (can be called in a per-channel basis when the circular buffer wraps)
77+
2-startChannelBlock*
78+
3-writeData* (per channel. Can be called more than once to account for the circular buffer wrap)
79+
4-endChannelBlock*
80+
4-writeEvent* (if needed)
81+
5-writeSpike* (if needed)
8082
When recording stops:
8183
closeFiles*
8284
@@ -97,11 +99,19 @@ class PLUGIN_API RecordEngine
9799
*/
98100
virtual void closeFiles() = 0;
99101

102+
/** Called by the record thread before it starts writing the channels to disk
103+
*/
104+
virtual void startChannelBlock();
105+
100106
/** Write continuous data for a channel. The raw buffer pointer is passed for speed,
101107
care must be taken to only read the specified number of bytes.
102108
*/
103109
virtual void writeData(int writeChannel, int realChannel, const float* buffer, int size) = 0;
104110

111+
/** Called by the record thread after it has written a channel block
112+
*/
113+
virtual void endChannelBlock();
114+
105115
/** Write a single event to disk.
106116
*/
107117
virtual void writeEvent(int eventType, const MidiMessage& event, int64 timestamp) = 0;

Source/Processors/RecordNode/RecordThread.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples
114114
Array<CircularBufferIndexes> idx;
115115
m_dataQueue->startRead(idx, timestamps, maxSamples);
116116
EVERY_ENGINE->updateTimestamps(timestamps);
117+
EVERY_ENGINE->startChannelBlock();
117118
for (int chan = 0; chan < m_numChannels; ++chan)
118119
{
119120
if (idx[chan].size1 > 0)
@@ -128,6 +129,7 @@ void RecordThread::writeData(const AudioSampleBuffer& dataBuffer, int maxSamples
128129
}
129130
}
130131
m_dataQueue->stopRead();
132+
EVERY_ENGINE->endChannelBlock();
131133

132134
std::vector<EventMessagePtr> events;
133135
int nEvents = m_eventQueue->getEvents(events, maxEvents);

0 commit comments

Comments
 (0)