diff --git a/runtime/elem/Runtime.h b/runtime/elem/Runtime.h index 051393e..66cfa38 100644 --- a/runtime/elem/Runtime.h +++ b/runtime/elem/Runtime.h @@ -343,7 +343,7 @@ namespace elem return ReturnCode::NodeNotFound(); if (auto ptr = std::dynamic_pointer_cast>(nodeTable.at(nodeId))) { - ptr->setProperty("active", true); + ptr->activate(currentRoots.empty() ? FloatType(1), FloatType(0)); active.insert(nodeId); } } diff --git a/runtime/elem/builtins/Core.h b/runtime/elem/builtins/Core.h index 89ce2f5..f0845c6 100644 --- a/runtime/elem/builtins/Core.h +++ b/runtime/elem/builtins/Core.h @@ -32,6 +32,12 @@ namespace elem return (t >= 0.5 || (std::abs(c - t) >= std::numeric_limits::epsilon())); } + void activate(FloatType initialGain = FloatType(0)) + { + setProperty("active", true); + currentGain.store(initialGain); + } + int setProperty(std::string const& key, js::Value const& val) override { if (key == "active") {