Skip to content

Commit

Permalink
Increase maximum standard input/output streams on Windows
Browse files Browse the repository at this point in the history
Fixes crash when recording hundreds of channels in Open Ephys format
  • Loading branch information
anjaldoshi committed Nov 8, 2024
1 parent f918c1c commit ab5fb9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Source/Processors/ProcessorGraph/ProcessorGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ ProcessorGraph::ProcessorGraph (bool isConsoleApp_) : isConsoleApp (isConsoleApp
AccessClass::setProcessorGraph (this);

pluginManager->loadAllPlugins();

#ifdef JUCE_WINDOWS
_setmaxstdio (8192);
#endif
}

ProcessorGraph::~ProcessorGraph()
Expand Down
20 changes: 0 additions & 20 deletions Source/Processors/RecordNode/RecordNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,26 +554,6 @@ void RecordNode::updateSettings()
else
++it;
}

#ifdef _WIN32
// check Open Ephys format on windows
if (recordEngine->getEngineId().equalsIgnoreCase ("OPENEPHYS") && getNumInputs() > 300)
{
int new_max = 0;
int calculated_max = getNumInputs() + getTotalEventChannels() + getTotalSpikeChannels() + getNumDataStreams() + 5;

if (calculated_max < 8192) // actual upper bound of 8192
new_max = _setmaxstdio (calculated_max);

if (new_max != calculated_max)
{
AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
"WARNING",
"Open Ephys format does not support this many simultaneously recorded channels. Resetting to Binary format.");
setEngine ("BINARY");
}
}
#endif
}

bool RecordNode::isSynchronized()
Expand Down

0 comments on commit ab5fb9d

Please sign in to comment.