|
31 | 31 |
|
32 | 32 | #include "../AudioNode/AudioNode.h" |
33 | 33 | #include "../RecordNode/RecordNode.h" |
| 34 | +#include "../FileReader/FileReader.h" |
34 | 35 | #include "../MessageCenter/MessageCenter.h" |
35 | 36 | #include "../MessageCenter/MessageCenterEditor.h" |
36 | 37 | #include "../Merger/Merger.h" |
@@ -1359,11 +1360,42 @@ bool ProcessorGraph::isReady() |
1359 | 1360 |
|
1360 | 1361 | LOGD("Checking that all processors are enabled..."); |
1361 | 1362 |
|
| 1363 | + int NWBCounter = 0; |
| 1364 | + |
1362 | 1365 | for (int i = 0; i < getNumNodes(); i++) |
1363 | 1366 | { |
1364 | 1367 |
|
1365 | 1368 | Node* node = getNode(i); |
1366 | 1369 |
|
| 1370 | + String name = node->getProcessor()->getName(); |
| 1371 | + |
| 1372 | + // 1. Check that NWB resources are only used by a single processor. |
| 1373 | + if (name == "File Reader") |
| 1374 | + { |
| 1375 | + FileReader* fr = static_cast<FileReader*>(node->getProcessor()); |
| 1376 | + |
| 1377 | + if (File(fr->getFile()).getFileExtension() == ".nwb") |
| 1378 | + NWBCounter += 1; |
| 1379 | + } |
| 1380 | + else if (name == "Record Node") |
| 1381 | + { |
| 1382 | + RecordNode* rn = static_cast<RecordNode*>(node->getProcessor()); |
| 1383 | + |
| 1384 | + if (rn->getEngineId() == "NWB2") |
| 1385 | + NWBCounter += 1; |
| 1386 | + } |
| 1387 | + |
| 1388 | + if (NWBCounter > 1) |
| 1389 | + { |
| 1390 | + AccessClass::getUIComponent()->disableCallbacks(); |
| 1391 | + |
| 1392 | + AlertWindow::showMessageBoxAsync(AlertWindow::WarningIcon, |
| 1393 | + "WARNING", "Open Ephys currently does not support multiple processors using NWB format. Please modify the signal chain accordingly to proceed with acquisition."); |
| 1394 | + |
| 1395 | + return false; |
| 1396 | + } |
| 1397 | + |
| 1398 | + // 2. Check that all processors are enabled and ready for acquisition. |
1367 | 1399 | if (node->nodeID != NodeID(OUTPUT_NODE_ID)) |
1368 | 1400 | { |
1369 | 1401 | GenericProcessor* p = (GenericProcessor*)node->getProcessor(); |
|
0 commit comments