mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioProcessorGraph: Return Node::Ptr from removeNode()
This commit is contained in:
parent
0d610c52b2
commit
606e8a509b
2 changed files with 8 additions and 9 deletions
|
|
@ -961,7 +961,7 @@ AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr<Aud
|
|||
return n;
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioProcessor> AudioProcessorGraph::removeNode (NodeID nodeId)
|
||||
AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (NodeID nodeId)
|
||||
{
|
||||
const ScopedLock sl (getCallbackLock());
|
||||
|
||||
|
|
@ -970,23 +970,22 @@ std::unique_ptr<AudioProcessor> AudioProcessorGraph::removeNode (NodeID nodeId)
|
|||
if (nodes.getUnchecked (i)->nodeID == nodeId)
|
||||
{
|
||||
disconnectNode (nodeId);
|
||||
auto internalProcessor = nodes[i] != nullptr ? std::move (nodes[i]->processor) : nullptr;
|
||||
nodes.remove (i);
|
||||
auto node = nodes.removeAndReturn (i);
|
||||
topologyChanged();
|
||||
return internalProcessor;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioProcessor> AudioProcessorGraph::removeNode (Node* node)
|
||||
AudioProcessorGraph::Node::Ptr AudioProcessorGraph::removeNode (Node* node)
|
||||
{
|
||||
if (node != nullptr)
|
||||
return removeNode (node->nodeID);
|
||||
|
||||
jassertfalse;
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -231,12 +231,12 @@ public:
|
|||
/** Deletes a node within the graph which has the specified ID.
|
||||
This will also delete any connections that are attached to this node.
|
||||
*/
|
||||
std::unique_ptr<AudioProcessor> removeNode (NodeID);
|
||||
Node::Ptr removeNode (NodeID);
|
||||
|
||||
/** Deletes a node within the graph.
|
||||
This will also delete any connections that are attached to this node.
|
||||
*/
|
||||
std::unique_ptr<AudioProcessor> removeNode (Node*);
|
||||
Node::Ptr removeNode (Node*);
|
||||
|
||||
/** Returns the list of connections in the graph. */
|
||||
std::vector<Connection> getConnections() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue