// single connections are made here by parameters. void MLProcMatrix::calcCoeffs() { const int in = (int)getParam("in"); const int out = (int)getParam("out"); const int use_in = (in > 0); const int use_out = (out > 0); const int mode = (use_in << 1) + use_out; switch(mode) { case 3: // both clearConnections(); connect(in, out); break; case 2: // in to 1 clearConnections(); connect(in, 1); break; case 1: // 1 to out clearConnections(); connect(1, out); break; case 0: default: break; } mParamsChanged = false; }
MLProcMatrix::MLProcMatrix() { setParam("in", 0.); setParam("out", 0.); mInputs = mOutputs = 0; // debug() << "MLProcMatrix constructor\n"; clearConnections(); }
void NetworkManager::abortTimer(QNetworkReply* reply) { if (timer_->isActive()) { timer_->stop(); Loggers::net->trace() << "timer stopped!"; } clearConnections(reply); }
void gProjectCore::updateConnections() { clearConnections(); descriptionConnections=connectionsStore->getDescriptionConnections(); for (int i=0;i<descriptionConnections.count();i++){ gDescriptionConnection descriptionConnection=descriptionConnections.at(i); gConnection *connection=new gConnection(descriptionConnection); connections.append(connection); checkConnectionInfrastructure(connection->host,connection->dbName); } }
void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSection> tabs) { clearConnections(); // clear processor graph std::cout << "Updating connections:" << std::endl; Array<GenericProcessor*> splitters; for (int n = 0; n < tabs.size(); n++) { std::cout << "Signal chain " << n << std::endl; GenericEditor* sourceEditor = (GenericEditor*) tabs[n]->getEditor(); GenericProcessor* source = (GenericProcessor*) sourceEditor->getProcessor(); while (source != 0)// && destEditor->isEnabled()) { std::cout << "Source node: " << source->getName() << ", "; GenericProcessor* dest = (GenericProcessor*) source->getDestNode(); if (dest != 0) { std::cout << "Dest node: " << dest->getName() << std::endl; if (dest->isMerger()) // move it forward by one { dest = dest->getDestNode(); } else if (dest->isSplitter()) { if (!dest->wasConnected) splitters.add(dest); dest = dest->getDestNode(); } } else { std::cout << "no dest node." << std::endl; } if (source->enabledState()) { // add the connections to audio and record nodes if necessary if (!(source->isSink() || source->isSplitter() || source->isMerger() || source->isUtility()) && !(source->wasConnected)) { std::cout << " Connecting to audio and record nodes." << std::endl; //source->setStartChannel(getAudioNode()->getNextChannel(false)); for (int chan = 0; chan < source->getNumOutputs(); chan++) { getAudioNode()->addInputChannel(source, chan); // std::cout << "Connecting to audio channel: " << // getAudioNode()->getNextChannel(false) << std::endl; //getAudioNode()->enableCurrentChannel(source->audioStatus(chan)); addConnection(source->getNodeId(), // sourceNodeID chan, // sourceNodeChannelIndex AUDIO_NODE_ID, // destNodeID getAudioNode()->getNextChannel(true)); // destNodeChannelIndex // add 2 to account for 2 output channels //std::cout << getAudioNode()->getNextChannel(false) << " "; getRecordNode()->addInputChannel(source, chan); // std::cout << "Connecting to record channel: " << // getRecordNode()->getNextChannel(false) << std::endl; addConnection(source->getNodeId(), // sourceNodeID chan, // sourceNodeChannelIndex RECORD_NODE_ID, // destNodeID getRecordNode()->getNextChannel(true)); // destNodeChannelIndex } // connect event channel addConnection(source->getNodeId(), // sourceNodeID midiChannelIndex, // sourceNodeChannelIndex RECORD_NODE_ID, // destNodeID midiChannelIndex); // destNodeChannelIndex // connect event channel addConnection(source->getNodeId(), // sourceNodeID midiChannelIndex, // sourceNodeChannelIndex AUDIO_NODE_ID, // destNodeID midiChannelIndex); // destNodeChannelIndex getRecordNode()->addInputChannel(source, midiChannelIndex); } std::cout << std::endl; if (dest != 0) { if (dest->enabledState()) std::cout << " OK." << std::endl; else std::cout << " Not OK." << std::endl; if (dest->enabledState()) { std::cout << " Connecting " << source->getName() << " channel "; for (int chan = 0; chan < source->getNumOutputs(); chan++) { std::cout << chan << " "; addConnection(source->getNodeId(), // sourceNodeID chan, // sourceNodeChannelIndex dest->getNodeId(), // destNodeID dest->getNextChannel(true)); // destNodeChannelIndex } std::cout << " to " << dest->getName() << std::endl; std::cout << " Connecting " << source->getName() << " event channel to " << dest->getName() << std::endl; // connect event channel addConnection(source->getNodeId(), // sourceNodeID midiChannelIndex, // sourceNodeChannelIndex dest->getNodeId(), // destNodeID midiChannelIndex); // destNodeChannelIndex } } } source->wasConnected = true; source = dest; // switch source and dest if (source == 0 && splitters.size() > 0) { dest = splitters.getFirst(); // dest is now the splitter splitters.remove(0); // take it out of the dest->switchIO(); // switch to the other destination dest->wasConnected = true; // don't want to re-add splitter source = dest->getSourceNode(); // splitter is now source } } // end while source != 0 } // end "tabs" for loop } // end method
void ProcessorGraph::updateConnections(Array<SignalChainTabButton*, CriticalSection> tabs) { clearConnections(); // clear processor graph std::cout << "Updating connections:" << std::endl; std::cout << std::endl; std::cout << std::endl; Array<GenericProcessor*> splitters; // GenericProcessor* activeSplitter = nullptr; for (int n = 0; n < tabs.size(); n++) // cycle through the tabs { std::cout << "Signal chain: " << n << std::endl; std::cout << std::endl; GenericEditor* sourceEditor = (GenericEditor*) tabs[n]->getEditor(); GenericProcessor* source = (GenericProcessor*) sourceEditor->getProcessor(); while (source != nullptr)// && destEditor->isEnabled()) { std::cout << "Source node: " << source->getName() << "." << std::endl; GenericProcessor* dest = (GenericProcessor*) source->getDestNode(); if (source->enabledState()) { // add the connections to audio and record nodes if necessary if (!(source->isSink() || source->isSplitter() || source->isMerger() || source->isUtility()) && !(source->wasConnected)) { std::cout << " Connecting to audio and record nodes." << std::endl; connectProcessorToAudioAndRecordNodes(source); } else { std::cout << " NOT connecting to audio and record nodes." << std::endl; } if (dest != nullptr) { while (dest->isMerger()) // find the next dest that's not a merger { dest = dest->getDestNode(); if (dest == nullptr) break; } if (dest != nullptr) { while (dest->isSplitter()) { if (!dest->wasConnected) { if (!splitters.contains(dest)) { splitters.add(dest); dest->switchIO(0); // go down first path } else { int splitterIndex = splitters.indexOf(dest); splitters.remove(splitterIndex); dest->switchIO(1); // go down second path dest->wasConnected = true; // make sure we don't re-use this splitter } } dest = dest->getDestNode(); if (dest == nullptr) break; } if (dest != nullptr) { if (dest->enabledState()) { connectProcessors(source, dest); } } } else { std::cout << " No dest node." << std::endl; } } else { std::cout << " No dest node." << std::endl; } } std::cout << std::endl; source->wasConnected = true; source = dest; // switch source and dest if (source == nullptr && splitters.size() > 0) { source = splitters.getLast(); GenericProcessor* newSource;// = source->getSourceNode(); while (source->isSplitter() || source->isMerger()) { newSource = source->getSourceNode(); newSource->setPathToProcessor(source); source = newSource; } } } // end while source != 0 } // end "tabs" for loop } // end method
gProjectCore::~gProjectCore() { clearConnections(); }