Skip to content

Commit

Permalink
Update RecordNode new dir creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
medengineer committed Feb 22, 2024
1 parent 910cffe commit 5d0036a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/CoreServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace CoreServices
for (auto* node : getProcessorGraph()->getRecordNodes())
{
if (node->getNodeId() == nodeId)
node->createNewDirectory();
node->createNewDirectory(true);
}
}

Expand Down
15 changes: 10 additions & 5 deletions Source/Processors/RecordNode/RecordNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,12 @@ void RecordNode::setDataDirectory(File directory)
dataDirectory = directory;
newDirectoryNeeded = true;

createNewDirectory();

checkDiskSpace();
}

void RecordNode::createNewDirectory()
void RecordNode::createNewDirectory(bool resetCounters)
{

LOGD("CREATE NEW DIRECTORY");
Expand All @@ -331,7 +333,7 @@ void RecordNode::createNewDirectory()
File recordingDirectory = rootFolder;
int index = 0;

while (recordingDirectory.exists())
while (resetCounters && recordingDirectory.exists())
{
index += 1;
recordingDirectory = File(rootFolder.getFullPathName() + " (" + String(index) + ")");
Expand All @@ -344,9 +346,12 @@ void RecordNode::createNewDirectory()

newDirectoryNeeded = false;

recordingNumber = 0;
experimentNumber = 1;
LOGD("RecordNode::createNewDirectory(): experimentNumber = 1");
if (resetCounters)
{
recordingNumber = 0;
experimentNumber = 1;
LOGD("RecordNode::createNewDirectory(): experimentNumber = 1");
}
settingsNeeded = true;

}
Expand Down
2 changes: 1 addition & 1 deletion Source/Processors/RecordNode/RecordNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class RecordNode :
String generateDirectoryName();

/* Creates a new recording directory*/
void createNewDirectory();
void createNewDirectory(bool resetCounters = false);

/* Callback for responding to changes in data-directory-related settings*/
void filenameComponentChanged(FilenameComponent*);
Expand Down
3 changes: 1 addition & 2 deletions Source/Processors/RecordNode/RecordNodeEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ void RecordNodeEditor::stopRecording()
spikeRecord->setEnabled(true);
}


void RecordNodeEditor::comboBoxChanged(ComboBox* box)
{

Expand Down Expand Up @@ -261,7 +260,7 @@ void RecordNodeEditor::updateSettings()
spikeRecord->setToggleState(recordNode->recordSpikes, dontSendNotification);

dataPathLabel->setText(recordNode->getDataDirectory().getFullPathName(), dontSendNotification);

dataPathLabel->setTooltip(dataPathLabel->getText());
}

void RecordNodeEditor::buttonClicked(Button *button)
Expand Down

0 comments on commit 5d0036a

Please sign in to comment.