From d0f8cb9c21a9de6b1aacc799fb49ba79e071ffc9 Mon Sep 17 00:00:00 2001 From: Caner Date: Fri, 9 Jan 2026 18:23:16 +0300 Subject: [PATCH 1/2] Fix Ring/BoundedQueue not using the pin values(alignment/size) given on creation/while generic --- Plugins/nosUtilities/Source/Ring.h | 48 +++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/Plugins/nosUtilities/Source/Ring.h b/Plugins/nosUtilities/Source/Ring.h index b9ea8376..1e7a2ee3 100644 --- a/Plugins/nosUtilities/Source/Ring.h +++ b/Plugins/nosUtilities/Source/Ring.h @@ -794,18 +794,40 @@ struct RingNodeBase : NodeContext resource = std::make_unique(); else resource = std::make_unique(); + if (auto inputVal = GetWatchedPinValue(NSN_Input)) + resource->CheckNewResource(NSN_Input, *inputVal, std::nullopt); + if (auto alignmentVal = GetWatchedPinValue(NSN_Alignment)) + resource->CheckNewResource(NSN_Alignment, *alignmentVal, std::nullopt); + size_t size = 1; + if (auto sizeVal = GetWatchedPinValue(NSN_Size)) + size = *InterpretPinValue(*sizeVal); + Ring = std::make_unique(size, std::move(resource)); - Ring = std::make_unique(1, std::move(resource)); Ring->Stop(); + } + + RingNodeBase(nosFbNodePtr node, OnRestartType onRestart) : NodeContext(node), OnRestart(onRestart), TypeInfo(NSN_Generic) + { + nos::Name typeName = NSN_Generic; + if(auto* pins = node->pins()) + for (auto* pin : *pins) + if (pin->name()->c_str() == NSN_Output) + IsOutLive = pin->live(); + for (auto& pin : Pins | std::views::values) + if (pin.TypeName != NSN_Generic && (pin.Name == NSN_Output || pin.Name == NSN_Input)) + typeName = pin.TypeName; + AddPinValueWatcher(NSN_Size, [this](nos::Buffer const& newSize, std::optional oldVal) { + if (!Ring) + return; uint32_t size = *newSize.As(); if (oldVal && oldVal == newSize) return; RequestRingResize(size); }); AddPinValueWatcher(NSN_Input, [this](nos::Buffer const& newBuf, std::optional oldVal) { - if (Ring->ResInterface->CheckNewResource(NSN_Input, newBuf, oldVal)) + if (Ring && Ring->ResInterface->CheckNewResource(NSN_Input, newBuf, oldVal)) { SendPathRestart(); Ring->Stop(); @@ -813,28 +835,18 @@ struct RingNodeBase : NodeContext } }); AddPinValueWatcher(NSN_Alignment, [this](nos::Buffer const& newAlignment, std::optional oldVal) { - if (Ring->ResInterface->CheckNewResource(NSN_Alignment, newAlignment, oldVal)) + if (Ring && Ring->ResInterface->CheckNewResource(NSN_Alignment, newAlignment, oldVal)) { SendPathRestart(); Ring->Stop(); NeedsRecreation = true; } }); - AddPinValueWatcher(NOS_NAME_STATIC("RepeatWhenFilling"), [this](nos::Buffer const& newVal, std::optional oldVal) { - RepeatWhenFilling = *newVal.As(); - }); - } - - RingNodeBase(nosFbNodePtr node, OnRestartType onRestart) : NodeContext(node), OnRestart(onRestart), TypeInfo(NSN_Generic) - { - nos::Name typeName = NSN_Generic; - if(auto* pins = node->pins()) - for (auto* pin : *pins) - if (pin->name()->c_str() == NSN_Output) - IsOutLive = pin->live(); - for (auto& pin : Pins | std::views::values) - if (pin.TypeName != NSN_Generic && (pin.Name == NSN_Output || pin.Name == NSN_Input)) - typeName = pin.TypeName; + AddPinValueWatcher(NOS_NAME_STATIC("RepeatWhenFilling"), + [this](nos::Buffer const& newVal, std::optional oldVal) { + RepeatWhenFilling = *newVal.As(); + nosEngine.SendPathRestart(NodeId); + }); if (typeName != NSN_Generic) { TypeInfo = nos::TypeInfo(typeName); Init(); From 91194f154322c31386afca9713e65734c8c65013 Mon Sep 17 00:00:00 2001 From: Caner Date: Fri, 9 Jan 2026 18:26:39 +0300 Subject: [PATCH 2/2] Fix build warning --- Plugins/nosUtilities/Source/Ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/nosUtilities/Source/Ring.h b/Plugins/nosUtilities/Source/Ring.h index 1e7a2ee3..7891f4bd 100644 --- a/Plugins/nosUtilities/Source/Ring.h +++ b/Plugins/nosUtilities/Source/Ring.h @@ -798,7 +798,7 @@ struct RingNodeBase : NodeContext resource->CheckNewResource(NSN_Input, *inputVal, std::nullopt); if (auto alignmentVal = GetWatchedPinValue(NSN_Alignment)) resource->CheckNewResource(NSN_Alignment, *alignmentVal, std::nullopt); - size_t size = 1; + uint32_t size = 1; if (auto sizeVal = GetWatchedPinValue(NSN_Size)) size = *InterpretPinValue(*sizeVal); Ring = std::make_unique(size, std::move(resource));