mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
AudioProcessorGraph: Allow nodes with ID 0 to be added
This commit is contained in:
parent
a8c114b570
commit
b91fec7787
3 changed files with 28 additions and 4 deletions
|
|
@ -2,6 +2,30 @@
|
|||
|
||||
# develop
|
||||
|
||||
## Change
|
||||
|
||||
The NodeID argument to AudioProcessorGraph::addNode() has been changed to take
|
||||
a std::optional<NodeID>.
|
||||
|
||||
**Possible Issues**
|
||||
|
||||
The behavior of any code calling AudioProcessorGraph::addNode(), that explicitly
|
||||
passes a default constructed NodeID or a NodeID constructed with a value of 0,
|
||||
will change. Previously these values would have been treated as a null value
|
||||
resulting in the actual NodeID being automatically determined. These will now
|
||||
be treated as requests for an explicit value.
|
||||
|
||||
**Workaround**
|
||||
|
||||
Either remove the explicit NodeID argument and rely on the default argument or
|
||||
pass a std::nullopt instead.
|
||||
|
||||
**Rationale**
|
||||
|
||||
The previous version prevented users from specifying a NodeID of 0 and resulted
|
||||
in unexpected behavior.
|
||||
|
||||
|
||||
## Change
|
||||
|
||||
The signature of DynamicObject::writeAsJSON() has been changed to accept a
|
||||
|
|
|
|||
|
|
@ -1694,7 +1694,7 @@ public:
|
|||
}
|
||||
|
||||
Node::Ptr addNode (std::unique_ptr<AudioProcessor> newProcessor,
|
||||
const NodeID nodeID,
|
||||
std::optional<NodeID> nodeID,
|
||||
UpdateKind updateKind)
|
||||
{
|
||||
if (newProcessor.get() == owner)
|
||||
|
|
@ -1703,7 +1703,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const auto idToUse = nodeID == NodeID() ? NodeID { ++(lastNodeID.uid) } : nodeID;
|
||||
const auto idToUse = nodeID.value_or (NodeID { lastNodeID.uid + 1 });
|
||||
|
||||
auto added = nodes.addNode (std::move (newProcessor), idToUse);
|
||||
|
||||
|
|
@ -1957,7 +1957,7 @@ bool AudioProcessorGraph::isAnInputTo (const Node& source, const Node& destinati
|
|||
bool AudioProcessorGraph::isAnInputTo (NodeID source, NodeID destination) const noexcept { return pimpl->isAnInputTo (source, destination); }
|
||||
|
||||
AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr<AudioProcessor> newProcessor,
|
||||
NodeID nodeId,
|
||||
std::optional<NodeID> nodeId,
|
||||
UpdateKind updateKind)
|
||||
{
|
||||
return pimpl->addNode (std::move (newProcessor), nodeId, updateKind);
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ public:
|
|||
|
||||
If this succeeds, it returns a pointer to the newly-created node.
|
||||
*/
|
||||
Node::Ptr addNode (std::unique_ptr<AudioProcessor> newProcessor, NodeID nodeId = {}, UpdateKind = UpdateKind::sync);
|
||||
Node::Ptr addNode (std::unique_ptr<AudioProcessor> newProcessor, std::optional<NodeID> nodeId = std::nullopt, UpdateKind = UpdateKind::sync);
|
||||
|
||||
/** Deletes a node within the graph which has the specified ID.
|
||||
This will also delete any connections that are attached to this node.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue