本文整理汇总了C++中Port::disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::disconnect方法的具体用法?C++ Port::disconnect怎么用?C++ Port::disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Port
的用法示例。
在下文中一共展示了Port::disconnect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addPlugin
/// TODO: This code can be simplified. Make a PortContainer class.
/// Plugin and Patch can inherit from PortContainer. We can have a
/// pseudo-PortContainer here to represent the input and output ports
/// Then, all adds/removals will be symetric
/// ^^^: Or, just wrap Plugin and BackendPorts with a class that acts this way
void FxLine::addPlugin(const PluginInfoPtr info, int pos)
{
int idx = pos + 1;
int pluginCnt = m_entries.length() - 2;
// Check for proper position value. TODO: Report error, not fatal
Q_ASSERT(pos <= pluginCnt);
// Create the plugin. TODO: Report error, not fatal
Plugin *plugin = info->createPlugin(48000);
Q_ASSERT(plugin);
plugin->activate(Engine::bufferProvider());
m_parent.add(plugin);
// Verify number of ports. TODO: Report error, not fatal
Q_ASSERT(plugin->audioInputCount() == 2);
Q_ASSERT(plugin->audioOutputCount() == 2);
// Collect ports.
Entry entry;
entry.plugin = plugin;
collectPorts(plugin, &entry.inputPorts, &entry.outputPorts);
Q_ASSERT(entry.inputPorts.length() == 2);
Q_ASSERT(entry.outputPorts.length() == 2);
/*
if (m_plugins.length() == 0) {
// If there are no plugins, we disconnect the backend ports from each
// other. Then, we connect the plugin in-between the backend ports
// TODO: Bring back once backend ports have patch?
// m_inPorts[0]->disconnect(m_outPorts[0]);
// m_inPorts[1]->disconnect(m_outPorts[1]);
m_inPorts[0]->connect(pluginIn.at(0));
m_inPorts[1]->connect(pluginIn.at(1));
m_outPorts[0]->connect(pluginOut.at(0));
m_outPorts[1]->connect(pluginOut.at(1));
}
else if (pos < m_plugins.length()) {
*/
// At this point, there is at least one plugin already in the line, and we
// are trying to insert the new plugin before another one.
Entry producer = m_entries.value(idx-1);
Entry consumer = m_entries.value(idx);
qWarning() << "FX LINE ADD producer port count:" << producer.outputPorts.count();
for (int i=0; i<producer.outputPorts.count(); ++i) {
Port *producerPort = producer.outputPorts.at(i);
Port *consumerPort = consumer.inputPorts.at(i);
// Work around:
if (producerPort->parentPatch() == NULL && consumerPort->parentPatch() == NULL) {
qWarning("Probably disconnecting two backend-ports. Ignoring");
}
else {
producerPort->disconnect(consumerPort);
}
qWarning() << "FX: Connecting: " << producerPort->name() << " TO " << entry.inputPorts.at(i)->name();
qWarning() << "FX: and Connecting: " << consumerPort->name() << " TO " << entry.outputPorts.at(i)->name();
producerPort->connect(entry.inputPorts.at(i));
consumerPort->connect(entry.outputPorts.at(i));
}
m_entries.insert(idx, entry);
}