Skip to content
Snippets Groups Projects
Commit 8c123eaa authored by jsiegle's avatar jsiegle
Browse files

Cleaned up ProcessorGraph code

parent f1f1ec41
No related branches found
No related tags found
No related merge requests found
......@@ -157,44 +157,17 @@ void ProcessorGraph::clearConnections()
removeConnection(i);
}
}
// std::cout << "Clearing nodes..." << std::endl;
// for (int i = 0; i < getNumNodes(); i++)
// {
// Node* node = getNode(i);
// int id = node->nodeId;
// if (!(id == RECORD_NODE_ID || id == AUDIO_NODE_ID ||
// id == OUTPUT_NODE_ID || id == RESAMPLING_NODE_ID))
// {
// removeNode(id);
// }
// }
// std::cout << "Remaining nodes: " << std::endl;
// for (int i = 0; i < getNumNodes(); i++)
// {
// Node* node = getNode(i);
// std::cout << " " << node->getProcessor()->getName() << std::endl;
// }
// std::cout << std::endl;
}
void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSection> tabs)
{
clearConnections(); // clear processor graph
//createDefaultNodes(); // add audio and record nodes
std::cout << "Updating connections:" << std::endl;
for (int n = 0; n < tabs.size(); n++)
{
std::cout << "Signal chain " << n << std::endl;
//if (tabs[n]->hasNewConnections())
//{
GenericEditor* sourceEditor = (GenericEditor*) tabs[n]->getEditor();
GenericProcessor* source = (GenericProcessor*) sourceEditor->getProcessor();
......@@ -213,11 +186,6 @@ void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSect
if (source->enabledState())
{
// add the source to the graph if it doesn't already exist
//Node* node = getNodeForId(source->getNodeId());
//if (node == 0)
// addNode(source, source->getNodeId());
// add the connections to audio and record nodes if necessary
if (!(source->isSink() || source->isSource() ||
source->isSplitter() || source->isMerger()))
......@@ -248,11 +216,6 @@ void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSect
if (dest->enabledState())
{
// add dest node to graph if it doesn't already exist
//node = getNodeForId(dest->getNodeId());
//if (node == 0)
// addNode(dest, dest->getNodeId());
std::cout << " Connecting " << source->getName() << " channel ";
for (int chan = 0; chan < source->getNumOutputs(); chan++)
......@@ -260,7 +223,7 @@ void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSect
// eventually need to account for splitter and mergers
std::cout << chan << " ";
std::cout << chan << " ";
addConnection(source->getNodeId(), // sourceNodeID
......@@ -314,13 +277,11 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
if (subProcessorType.equalsIgnoreCase("Intan Demo Board")) {
if (!doesProcessorWithSameNameExist(subProcessorType)) {
// only one Intan Demo Board at a time, please
if (!processorWithSameNameExists(subProcessorType)) {
processor = new SourceNode(subProcessorType);
//} else {
}
std::cout << "Creating a new data source." << std::endl;
} else if (subProcessorType.equalsIgnoreCase("Signal Generator"))
{
......@@ -366,8 +327,6 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
} else if (processorType.equalsIgnoreCase("Sinks")) {
//if (subProcessorType.equalsIgnoreCase("Stream Viewer")) {
if (subProcessorType.equalsIgnoreCase("LFP Viewer")) {
std::cout << "Creating a display node." << std::endl;
processor = new LfpDisplayNode();
......@@ -379,7 +338,6 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
std::cout << "Creating a WiFi node." << std::endl;
processor = new WiFiOutput();
}
//}
sendActionMessage("New sink created.");
}
......@@ -388,7 +346,7 @@ GenericProcessor* ProcessorGraph::createProcessorFromDescription(String& descrip
}
bool ProcessorGraph::doesProcessorWithSameNameExist(const String& name)
bool ProcessorGraph::processorWithSameNameExists(const String& name)
{
for (int i = 0; i < getNumNodes(); i++)
{
......@@ -414,7 +372,6 @@ void ProcessorGraph::removeProcessor(GenericProcessor* processor) {
void ProcessorGraph::setUIComponent(UIComponent* ui)
{
UI = ui;
//config = ui->getConfiguration();
}
void ProcessorGraph::setFilterViewport(FilterViewport* fv)
......@@ -517,20 +474,6 @@ RecordNode* ProcessorGraph::getRecordNode() {
}
GenericProcessor* ProcessorGraph::getSourceNode(int snID) {
std::cout << "Requested ID: " << snID << std::endl;
//if (snID != 0) {
Node* node = getNodeForId(snID);
if (node != 0) {
return (GenericProcessor*) node->getProcessor();
} else {
return 0;
}
}
void ProcessorGraph::saveState()
{
File file = File("./savedState.xml");
......
......@@ -67,7 +67,6 @@ public:
bool disableProcessors();
RecordNode* getRecordNode();
GenericProcessor* getSourceNode(int snID);
AudioNode* getAudioNode();
void setUIComponent(UIComponent* ui);
......@@ -77,7 +76,7 @@ public:
void updateConnections(Array<SignalChainTabButton*, CriticalSection>);
bool doesProcessorWithSameNameExist(const String& name);
bool processorWithSameNameExists(const String& name);
void saveState();
void loadState();
......
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