| @@ -2,6 +2,30 @@ | |||||
| # develop | # 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 | ## Change | ||||
| The signature of DynamicObject::writeAsJSON() has been changed to accept a | The signature of DynamicObject::writeAsJSON() has been changed to accept a | ||||
| @@ -1694,7 +1694,7 @@ public: | |||||
| } | } | ||||
| Node::Ptr addNode (std::unique_ptr<AudioProcessor> newProcessor, | Node::Ptr addNode (std::unique_ptr<AudioProcessor> newProcessor, | ||||
| const NodeID nodeID, | |||||
| std::optional<NodeID> nodeID, | |||||
| UpdateKind updateKind) | UpdateKind updateKind) | ||||
| { | { | ||||
| if (newProcessor.get() == owner) | if (newProcessor.get() == owner) | ||||
| @@ -1703,7 +1703,7 @@ public: | |||||
| return nullptr; | 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); | 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); } | bool AudioProcessorGraph::isAnInputTo (NodeID source, NodeID destination) const noexcept { return pimpl->isAnInputTo (source, destination); } | ||||
| AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr<AudioProcessor> newProcessor, | AudioProcessorGraph::Node::Ptr AudioProcessorGraph::addNode (std::unique_ptr<AudioProcessor> newProcessor, | ||||
| NodeID nodeId, | |||||
| std::optional<NodeID> nodeId, | |||||
| UpdateKind updateKind) | UpdateKind updateKind) | ||||
| { | { | ||||
| return pimpl->addNode (std::move (newProcessor), nodeId, 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. | 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. | /** Deletes a node within the graph which has the specified ID. | ||||
| This will also delete any connections that are attached to this node. | This will also delete any connections that are attached to this node. | ||||