Skip to content

Commit 1c31869

Browse files
committed
Add comments
1 parent c492542 commit 1c31869

5 files changed

Lines changed: 55 additions & 9 deletions

File tree

Plugins/IntanRecordingController/RHD2000Editor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ void RHD2000Editor::handleAsyncUpdate()
737737
canvas->updateImpedance(impedanceData->streams, impedanceData->channels, impedanceData->magnitudes, impedanceData->phases);
738738
if (saveImpedances)
739739
{
740+
// this may not work with new Record Node architecture
740741
CoreServices::RecordNode::createNewrecordingDir();
741742

742743
String path(CoreServices::RecordNode::getRecordingPath().getFullPathName()

Source/Processors/RecordNode/BinaryFormat/BinaryRecording.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,4 +695,4 @@ RecordEngineManager* BinaryRecording::getEngineManager()
695695
void BinaryRecording::setParameter(EngineParameter& parameter)
696696
{
697697
boolParameter(0, m_saveTTLWords);
698-
}
698+
}

Source/Processors/RecordNode/RecordEngine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class PLUGIN_API RecordEngine
6565
/** All the public methods (except registerManager) are called by RecordNode or RecordingThread:
6666
When acquisition starts (in the specified order):
6767
1-resetChannels
68-
2-registerProcessor, addChannel, registerSpikeSource, addspikeelectrode
68+
2-registerProcessor, addChannel, registerSpikeSource, addSpikeElectrode
6969
3-configureEngine (which calls setParameter)
7070
3-startAcquisition
7171
When recording starts (in the specified order):

Source/Processors/RecordNode/RecordNode.cpp

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ String RecordNode::generateDirectoryName()
172172

173173
AccessClass::getControlPanel()->setDateText(datestring);
174174

175-
if (filename.length() < 24)
175+
if (filename.length() < 24) // this is a hack
176176
filename += datestring;
177177
else
178178
filename = filename.substring(0, filename.length() - 1);
@@ -183,23 +183,27 @@ String RecordNode::generateDirectoryName()
183183

184184
}
185185

186+
// called by FifoMonitor
186187
File RecordNode::getDataDirectory()
187188
{
188189
return dataDirectory;
189190
}
190191

192+
// called by RecordNodeEditor
191193
void RecordNode::setDataDirectory(File directory)
192194
{
193195
dataDirectory = directory;
194196
newDirectoryNeeded = true;
195197
}
196198

199+
// called by RecordNode::startRecording and RHD2000Editor (should be removed)
197200
void RecordNode::createNewDirectory()
198201
{
199202
rootFolder = File(dataDirectory.getFullPathName() + File::separator + generateDirectoryName() + File::separator + getName() + " " + String(getNodeId()));
200203
newDirectoryNeeded = false;
201204
}
202205

206+
// called by RecordEngine
203207
String RecordNode::generateDateString() const
204208
{
205209

@@ -235,35 +239,42 @@ String RecordNode::generateDateString() const
235239

236240
}
237241

242+
// called by CoreServices
238243
int RecordNode::getExperimentNumber() const
239244
{
240245
LOGD(__FUNCTION__, " = ", experimentNumber);
241246
return experimentNumber;
242247
}
243248

249+
// called by CoreServices
244250
int RecordNode::getRecordingNumber() const
245251
{
246252
LOGD(__FUNCTION__, " = ", recordingNumber);
247253
return recordingNumber;
248254
}
249255

256+
// called by ProcessorGraph::createNewProcessor
250257
AudioProcessorEditor* RecordNode::createEditor()
251258
{
252259
editor = new RecordNodeEditor(this, true);
253260
return editor;
254261
}
255262

263+
// Juce method, not used
256264
void RecordNode::prepareToPlay(double sampleRate, int estimatedSamplesPerBlock)
257265
{
258266
/* This gets called right when the play button is pressed*/
259267
}
260268

269+
// called by RecordEngine when saving the signal chain
261270
const String &RecordNode::getLastSettingsXml() const
262271
{
263272
return lastSettingsText;
264273
}
265274

266-
/* Use this function to change paramaters while recording...*/
275+
/* Use this function to change parameters while recording...*/
276+
// Called by:
277+
// - EngineConfigComponent (3, 0.0f) -- used to disable record thread (deprecated?)
267278
void RecordNode::setParameter(int parameterIndex, float newValue)
268279
{
269280
editor->updateParameterButtons(parameterIndex);
@@ -276,17 +287,20 @@ void RecordNode::setParameter(int parameterIndex, float newValue)
276287

277288
}
278289

290+
// Called by ProcessorGraph::enableProcessors()
279291
void RecordNode::updateRecordChannelIndexes()
280292
{
281293
//Keep the nodeIDs of the original processor from each channel comes from
282294
updateChannelIndexes(false);
283295
}
284296

297+
// Called when deleting FifoMonitor
285298
void RecordNode::updateChannelStates(int srcIndex, int subProcIdx, std::vector<bool> channelStates)
286299
{
287300
this->dataChannelStates[srcIndex][subProcIdx] = channelStates;
288301
}
289302

303+
// called by updateSettings (could be refactored)
290304
void RecordNode::updateSubprocessorMap()
291305
{
292306

@@ -384,40 +398,48 @@ void RecordNode::updateSubprocessorMap()
384398
}
385399
}
386400

401+
// called by GenericProcessor, RecordNodeEditor, SourceProcessorInfo,
402+
// TimestampSourceSelectionComponent
387403
int RecordNode::getNumSubProcessors() const
388404
{
389405
return numSubprocessors;
390406
}
391407

408+
// called by RecordNodeEditor (when loading), SyncControlButton
392409
void RecordNode::setMasterSubprocessor(int srcIndex, int subProcIdx)
393410
{
394411
synchronizer->setMasterSubprocessor(srcIndex, subProcIdx);
395412
}
396413

414+
// called by RecordNodeEditor (when loading), SyncControlButton
397415
void RecordNode::setSyncChannel(int srcIndex, int subProcIdx, int channel)
398416
{
399417
syncChannelMap[srcIndex][subProcIdx] = channel;
400418
synchronizer->setSyncChannel(srcIndex, subProcIdx, syncOrderMap[srcIndex][subProcIdx]+channel);
401419
}
402420

421+
// called by SyncControlButton
403422
int RecordNode::getSyncChannel(int srcIndex, int subProcIdx)
404423
{
405424
return syncChannelMap[srcIndex][subProcIdx];
406425
//return synchronizer->getSyncChannel(srcIndex, subProcIdx);
407426
}
408427

428+
// called by SyncControlButton
409429
bool RecordNode::isMasterSubprocessor(int srcIndex, int subProcIdx)
410430
{
411431
return (srcIndex == synchronizer->masterProcessor && subProcIdx == synchronizer->masterSubprocessor);
412432
}
413433

434+
// called by GenericProcessor::update()
414435
void RecordNode::updateSettings()
415436
{
416437

417438
updateSubprocessorMap();
418439

419440
}
420441

442+
// called by GenericProcessor::enableProcessor
421443
bool RecordNode::enable()
422444
{
423445

@@ -439,6 +461,7 @@ bool RecordNode::enable()
439461

440462
}
441463

464+
// called by GenericProcessor::setRecording()
442465
void RecordNode::startRecording()
443466
{
444467

@@ -559,6 +582,7 @@ void RecordNode::startRecording()
559582

560583
}
561584

585+
// called by GenericProcessor::setRecording()
562586
void RecordNode::stopRecording()
563587
{
564588

@@ -592,7 +616,7 @@ void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& e
592616
if (!msgCenterMessages.contains(Event::getTimestamp(event)))
593617
{
594618
msgCenterMessages.add(Event::getTimestamp(event));
595-
std::cout << "Received event." << std::endl;
619+
std::cout << "Received message." << std::endl;
596620
}
597621
else
598622
return;
@@ -602,7 +626,7 @@ void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& e
602626

603627
if (recordEvents)
604628
{
605-
629+
// flags whether or not to write events
606630

607631
int64 timestamp = Event::getTimestamp(event);
608632
uint64 eventChan = event.getChannel();
@@ -622,11 +646,10 @@ void RecordNode::handleEvent(const EventChannel* eventInfo, const MidiMessage& e
622646

623647
}
624648

625-
649+
// only called if recordSpikes is true
626650
void RecordNode::handleSpike(const SpikeChannel* spikeInfo, const MidiMessage& event, int samplePosition)
627651
{
628-
629-
652+
630653
SpikeEventPtr newSpike = SpikeEvent::deserializeFromMessage(event, spikeInfo);
631654
if (!newSpike)
632655
{
@@ -747,30 +770,35 @@ void RecordNode::process(AudioSampleBuffer& buffer)
747770

748771
}
749772

773+
// called by process method
750774
bool RecordNode::isFirstChannelInRecordedSubprocessor(int ch)
751775
{
752776
return std::find(startRecChannels.begin(), startRecChannels.end(), ch) != startRecChannels.end();
753777
}
754778

779+
// called by ProcessorGraph::connectProcessors
755780
void RecordNode::registerProcessor(const GenericProcessor* sourceNode)
756781
{
757782
settings.numInputs += sourceNode->getNumOutputs();
758783
setPlayConfigDetails(getNumInputs(), getNumOutputs(), 44100.0, 128);
759784
recordEngine->registerProcessor(sourceNode);
760785
}
761786

787+
// not called
762788
void RecordNode::registerSpikeSource(const GenericProcessor *processor)
763789
{
764790
recordEngine->registerSpikeSource(processor);
765791
}
766792

793+
// not called
767794
int RecordNode::addSpikeElectrode(const SpikeChannel *elec)
768795
{
769796
spikeChannelArray.add(new SpikeChannel(*elec));
770797
recordEngine->addSpikeElectrode(spikeElectrodeIndex, elec);
771798
return spikeElectrodeIndex++;
772799
}
773800

801+
// called in RecordNode::handleSpike
774802
void RecordNode::writeSpike(const SpikeEvent *spike, const SpikeChannel *spikeElectrode)
775803
{
776804
//if (isRecording && shouldRecord)
@@ -783,23 +811,27 @@ void RecordNode::writeSpike(const SpikeEvent *spike, const SpikeChannel *spikeEl
783811
}
784812
}
785813

814+
// FileNameComponent listener
786815
void RecordNode::filenameComponentChanged(FilenameComponent *fnc)
787816
{
788817

789818
dataDirectory = fnc->getCurrentFile();
790819
newDirectoryNeeded = true;
791820
}
792821

822+
// not called?
793823
float RecordNode::getFreeSpace() const
794824
{
795825
return 1.0f - float(dataDirectory.getBytesFreeOnVolume()) / float(dataDirectory.getVolumeTotalSize());
796826
}
797827

828+
// not called?
798829
void RecordNode::registerRecordEngine(RecordEngine *engine)
799830
{
800831
engineArray.add(engine);
801832
}
802833

834+
// not called?
803835
void RecordNode::clearRecordEngines()
804836
{
805837
engineArray.clear();

Source/Processors/RecordNode/RecordNode.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,21 @@ class RecordNode : public GenericProcessor, public FilenameComponentListener
4646

4747
public:
4848

49+
/** Constructor
50+
- Creates: DataQueue, EventQueue, SpikeQueue, Synchronizer,
51+
RecordThread, EventMonitor
52+
- Sets the Record Engine
53+
- Gets the Recording Directory from the control panel
54+
- Sets a bunch of internal variables
55+
*/
4956
RecordNode();
57+
58+
/** Destructor
59+
- Doesn't need to delete anything manually
60+
*/
5061
~RecordNode();
5162

63+
/** If messageCenter event channel is not present in EventChannelArray, add it*/
5264
void connectToMessageCenter();
5365

5466
void updateRecordChannelIndexes();
@@ -127,6 +139,7 @@ class RecordNode : public GenericProcessor, public FilenameComponentListener
127139
bool isSyncReady;
128140

129141
//TODO: Need to validate these new methods
142+
/** Deprecated*/
130143
void addInputChannel(const GenericProcessor* sourceNode, int chan);
131144

132145
/** Must be called by a spike recording source on the "enable" method

0 commit comments

Comments
 (0)