Skip to content
Snippets Groups Projects
Commit 4ea79bfa authored by jsiegle's avatar jsiegle
Browse files

Add 'allFilesOpened' check to make sure recording doesn't start until all files have been opened

parent eb916d5e
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ RecordNode::RecordNode()
isProcessing = false;
isRecording = false;
allFilesOpened = false;
blockIndex = 0;
signalFilesShouldClose = false;
......@@ -383,6 +384,8 @@ void RecordNode::setParameter(int parameterIndex, float newValue)
}
}
allFilesOpened = true;
}
else if (parameterIndex == 0)
{
......@@ -470,10 +473,13 @@ void RecordNode::openFile(Channel* ch)
//std::cout << header << std::endl;
std::cout << "File ID: " << chFile << ", number of bytes: " << header.getNumBytesAsUTF8() << std::endl;
fwrite(header.toUTF8(), 1, header.getNumBytesAsUTF8(), chFile);
std::cout << "Wrote header." << std::endl;
std::cout << "Block index: " << blockIndex << std::endl;
}
else
{
......@@ -583,6 +589,8 @@ void RecordNode::closeAllFiles()
closeFile(eventChannel);
blockIndex = 0; // back to the beginning of the block
allFilesOpened = false;
}
bool RecordNode::enable()
......@@ -769,7 +777,7 @@ void RecordNode::process(AudioSampleBuffer& buffer,
// CONSTRAINTS:
// samplesWritten must equal nSamples by the end of the process() method
if (isRecording)
if (isRecording && allFilesOpened)
{
// FIRST: cycle through events -- extract the TTLs and the timestamps
......
......@@ -122,6 +122,7 @@ public:
bool newDirectoryNeeded;
bool isRecording;
bool allFilesOpened;
/** Generate a Matlab-compatible datestring */
String generateDateString();
......
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