Skip to content

Commit

Permalink
Document RecordEngine header
Browse files Browse the repository at this point in the history
  • Loading branch information
aacuevas committed Sep 18, 2014
1 parent 28c5a04 commit 62c5a7a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
76 changes: 72 additions & 4 deletions Source/Processors/RecordEngine.h
Expand Up @@ -45,24 +45,92 @@ class RecordEngine : public AccessClass
public:
RecordEngine();
~RecordEngine();

/** All the public methods are called by RecordNode:
When acquisition starts (in the specified order):
1-resetChannels
2-registerProcessor, addChannel, registerSpikeSource, addspikeelectrode
3-startAcquisition
When recording starts (in the specified order):
1-directoryChanged (if needed)
2-openFiles
During recording:
writeData, writeEvent, writeSpike, updateTimeStamp
When recording stops:
closeFiles
*/

/** Called when recording starts to open all needed files
*/
virtual void openFiles(File rootFolder, int experimentNumber, int recordingNumber) =0;

/** Called when recording stops to close all files
and do all the necessary cleanups
*/
virtual void closeFiles() =0;

/** Write continuous data.
This method gets the full data buffer, it must query getRecordState for
each registered channel to determine which channels to actually write to disk
*/
virtual void writeData(AudioSampleBuffer& buffer, int nSamples) =0;

/** Write a single event to disk.
*/
virtual void writeEvent(int eventType, MidiMessage& event, int samplePosition) =0;
virtual void addChannel(int index, Channel* chan) =0;

/** Called when acquisition starts once for each processor that might record continuous data
*/
virtual void registerProcessor(GenericProcessor* processor);

/** Called after registerProcessor, once for each output
channel of the processor
*/
virtual void addChannel(int index, Channel* chan) =0;

/** Called when acquisition starts once for each processor that might record spikes
*/
virtual void registerSpikeSource(GenericProcessor* processor);

/** Called after registerSpikesource, once for each channel group
*/
virtual void addSpikeElectrode(int index, SpikeRecordInfo* elec) =0;

/** Write a spike to disk
*/
virtual void writeSpike(const SpikeObject& spike, int electrodeIndex) =0;
virtual void registerProcessor(GenericProcessor* processor);
virtual void registerSpikeSource(GenericProcessor* processor);

/** Called when a new acquisition starts, to clean all channel data
before registering the processors
*/
virtual void resetChannels();

/** Called every time a new timestamp event is received
*/
virtual void updateTimeStamp(int64 timestamp);

/** Called after all channels and spike groups have been registered,
just before acquisition starts
*/
virtual void startAcquisition();

/** Called when the recording directory changes during an acquisition
*/
virtual void directoryChanged();

protected:
/** Functions to access RecordNode arrays and utilities
*/

/** Gets the specified channel from the channel array stored in RecordNode
*/
Channel* getChannel(int index);

/** Gets the specified channel group info structure from the array stored in RecordNode
*/
SpikeRecordInfo* getSpikeElectrode(int index);

/** Generate a Matlab-compatible datestring
*/
String generateDateString();

private:
Expand Down
18 changes: 18 additions & 0 deletions Source/Processors/RecordNode.h
Expand Up @@ -72,12 +72,18 @@ class RecordNode : public GenericProcessor,
*/
void setParameter(int parameterIndex, float newValue);

/** Called by the processor graph for each processor that could record data
*/
void registerProcessor(GenericProcessor* sourceNode);
/** Called by the processor graph for each recordable channel
*/
void addInputChannel(GenericProcessor* sourceNode, int chan);

bool enable();
bool disable();

/** Get channel stored in channelPointers array
*/
Channel* getDataChannel(int index);

/** Called by the ControlPanel to determine the amount of space
Expand Down Expand Up @@ -113,14 +119,26 @@ class RecordNode : public GenericProcessor,
return rootFolder;
}

/** Adds a Record Engine to use
*/
void registerRecordEngine(RecordEngine* engine);

/** Clears the list of active Record Engines
*/
void clearRecordEngines();

/** Must be called by a spike recording source on the "enable" method
*/
void registerSpikeSource(GenericProcessor* processor);

/** Registers an electrode group for spike recording
Must be called by a spike recording source on the "enable" method
after the call to registerSpikeSource
*/
int addSpikeElectrode(SpikeRecordInfo* elec);

/** Called by a spike recording source to write a spike to file
*/
void writeSpike(SpikeObject& spike, int electrodeIndex);

SpikeRecordInfo* getSpikeElectrode(int index);
Expand Down

0 comments on commit 62c5a7a

Please sign in to comment.