//------------------------------------------------------------------------------ void PluginField::addFilter(int index, bool broadcastChangeMessage) { int x, y; PluginComponent *plugin; AudioProcessorGraph::Node *node; if(index < signalPath->getNumFilters()) { node = signalPath->getNode(index); if(node->getProcessor()->getName() != "Midi Interceptor") { //Make sure the plugin knows about the AudioPlayHead. node->getProcessor()->setPlayHead(this); plugin = new PluginComponent(node); x = signalPath->getNode(index)->properties.getWithDefault("x", 0); y = signalPath->getNode(index)->properties.getWithDefault("y", 0); plugin->setTopLeftPosition(x, y); plugin->addChangeListener(this); addAndMakeVisible(plugin); //To make sure the plugin field bounds are correct. changeListenerCallback(plugin); if(broadcastChangeMessage) sendChangeMessage(); } } }
//------------------------------------------------------------------------------ void PluginField::enableMidiForNode(AudioProcessorGraph::Node *node, bool val) { int i; bool connection = false; AudioProcessorGraph::Node *midiInput = 0; //Find the Midi Input node. for(i=0;i<signalPath->getNumFilters();++i) { midiInput = signalPath->getNode(i); if(midiInput->getProcessor()->getName() == "Midi Input") break; } //Just in case. if(midiInput) { if(midiInput->getProcessor()->getName() != "Midi Input") return; } else return; //Check if there's a connection. connection = (signalPath->getConnectionBetween(midiInput->nodeId, AudioProcessorGraph::midiChannelIndex, node->nodeId, AudioProcessorGraph::midiChannelIndex) != 0); if(val) { //If there's a connection, remove it. signalPath->removeConnection(midiInput->nodeId, AudioProcessorGraph::midiChannelIndex, node->nodeId, AudioProcessorGraph::midiChannelIndex); } else { //If there's not a connection, add it. signalPath->addConnection(midiInput->nodeId, AudioProcessorGraph::midiChannelIndex, node->nodeId, AudioProcessorGraph::midiChannelIndex); } }
//------------------------------------------------------------------------------ bool PluginField::getMidiEnabledForNode(AudioProcessorGraph::Node *node) const { int i; AudioProcessorGraph::Node *midiInput = 0; //Find the Midi Input node. for(i=0;i<signalPath->getNumFilters();++i) { midiInput = signalPath->getNode(i); if(midiInput->getProcessor()->getName() == "Midi Input") break; else midiInput = 0; } if(!midiInput) return false; else return signalPath->getConnectionBetween(midiInput->nodeId, AudioProcessorGraph::midiChannelIndex, node->nodeId, AudioProcessorGraph::midiChannelIndex) != 0; }
bool MessageCenter::enable() { messageCenterEditor->startAcquisition(); lastTime = Time::getHighResolutionTicks(); softTimestamp = 0; if (sourceNodeId) { AudioProcessorGraph::Node* node = AccessClass::getProcessorGraph()->getNodeForId(sourceNodeId); if (node) { timestampSource = static_cast<GenericProcessor*>(node->getProcessor()); } else { std::cout << "Message Center: BAD node id " << sourceNodeId << std::endl; timestampSource = nullptr; sourceNodeId = 0; } } else timestampSource = nullptr; return true; }