Skip to content

Commit fb88ef4

Browse files
committed
Add validation for record node directories before starting recording
1 parent 14908cf commit fb88ef4

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

Source/Processors/ProcessorGraph/ProcessorGraph.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,22 @@ bool ProcessorGraph::allRecordNodesAreSynchronized()
11061106
return true;
11071107
}
11081108

1109+
bool ProcessorGraph::allRecordNodeDirectoriesAreValid()
1110+
{
1111+
Array<GenericProcessor*> processors = getListOfProcessors();
1112+
1113+
for (auto p : processors)
1114+
{
1115+
if (p->isRecordNode())
1116+
{
1117+
auto* pathParam = p->getParameter ("directory");
1118+
if (pathParam != nullptr && ! pathParam->isValid())
1119+
return false;
1120+
}
1121+
}
1122+
return true;
1123+
}
1124+
11091125
bool ProcessorGraph::hasRecordNode()
11101126
{
11111127
Array<GenericProcessor*> processors = getListOfProcessors();

Source/Processors/ProcessorGraph/ProcessorGraph.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ class TESTABLE ProcessorGraph : public AudioProcessorGraph, public ChangeListene
205205
/** Returns true if all record nodes are synchronized */
206206
bool allRecordNodesAreSynchronized();
207207

208+
/** Returns true if all record nodes have valid recording directories */
209+
bool allRecordNodeDirectoriesAreValid();
210+
208211
/** Saves processor graph to XML */
209212
void saveToXml (XmlElement* xml);
210213

Source/UI/ControlPanel.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,24 @@ void ControlPanel::buttonClicked (Button* button)
11711171
}
11721172
else
11731173
{
1174+
if (! graph->allRecordNodeDirectoriesAreValid() && getAcquisitionState())
1175+
{
1176+
recordButton->setToggleState (false, dontSendNotification);
1177+
playButton->setToggleState (false, dontSendNotification);
1178+
stopAcquisition();
1179+
1180+
if (! isConsoleApp)
1181+
{
1182+
getLookAndFeel().playAlertSound();
1183+
AlertWindow::showMessageBox (AlertWindow::WarningIcon,
1184+
"Recording Error",
1185+
"One or more Record Nodes have an invalid recording path set. "
1186+
"Please ensure all Record Nodes are configured with a valid recording path before starting the recording.");
1187+
}
1188+
CoreServices::sendStatusMessage ("One or more Record Nodes have invalid recording path");
1189+
return;
1190+
}
1191+
11741192
if (! graph->allRecordNodesAreSynchronized() && ! forceRecording)
11751193
{
11761194
recordButton->setToggleState (false, dontSendNotification);

0 commit comments

Comments
 (0)