Invocation: implement support for simple time-based automation

Actually this is now quite easy to implement, as a shortcut on top of generic functionality;
just in this case the param-functor takes a Time value as argument.
So its more a matter of documentation to provide a dedicated hook for this common case.
This commit is contained in:
Fischlurch 2025-01-05 01:01:15 +01:00
parent 32c21b6a8f
commit 061d20e08d
5 changed files with 71 additions and 22 deletions

View file

@ -84,10 +84,9 @@ namespace meta {
advice::Provision<PQuant>(bindingID).setAdvice(quantiser);
return gridImplementation;
}
}//(End)Impl helper.
}
/**
* TimeGrid implementation: a trivial time grid,
* starting at a given point in time and using a
@ -149,7 +148,7 @@ namespace meta {
// build new Meta-Asset, registered with AssetManager, and publish into Advice-System
return publishWrapped (*new SimpleTimeGrid(origin, fps, nameID)); ///////////////////////////TICKET #840 currently this replaces an existing Registration. What do we actually want here?
}
} /////////////////////////// Remark 1/2025 : Tests meanwhile rely on being able just to replace a Grid without much ado. Seems natural this way...
/* === TimeGrid shortcut builder functions === */

View file

@ -441,8 +441,7 @@ namespace engine {
return attachParamFun ([automation = forward<AUTO>(aFun)]
(TurnoutSystem& turnoutSys)
{
Time nomTime = Time::ZERO; ////////////////////OOO need to retrieve that from turnoutSys
return automation(nomTime);
return automation (turnoutSys.getNomTime());
});
}

View file

@ -19,17 +19,28 @@
#include "lib/test/run.hpp"
#include "steam/engine/node-builder.hpp"
#include "steam/engine/diagnostic-buffer-provider.hpp"
#include "steam/asset/meta/time-grid.hpp"
#include "lib/test/diagnostic-output.hpp"
#include "lib/time/timequant.hpp"
#include "lib/time/timecode.hpp"
#include "lib/symbol.hpp"
//#include "lib/util.hpp"
using lib::Symbol;
using std::string;
using lib::time::Time;
using lib::time::QuTime;
using lib::time::FrameNr;
using lib::time::SmpteTC;
namespace steam {
namespace engine{
namespace test {
namespace {
Symbol SECONDS_GRID = "grid_sec";
}
@ -41,6 +52,9 @@ namespace test {
virtual void
run (Arg)
{
seedRand(); // used for simple time-based „automation“
steam::asset::meta::TimeGrid::build (SECONDS_GRID, 1);
build_simpleNode();
build_Node_fixedParam();
build_Node_dynamicParam();
@ -114,13 +128,37 @@ namespace test {
}
/** @test TODO build a Node with dynamically generated parameter
* @todo WIP 12/24 🔁 define implement
/** @test build a Node with dynamically generated parameter
* - use a processing function which takes a parameter
* - use an _automation functor,_ which just quantises
* the time into an implicitly defined grid
* - install both into a render node
* - set a random _nominal time_ for invocation
* @todo 12/24 define implement
*/
void
build_Node_dynamicParam()
{
UNIMPLEMENTED ("build node with param-functor");
auto procFun = [](long param, int* buff){ *buff = int(param); };
auto autoFun = [](Time nomTime){ return FrameNr::quant (nomTime, SECONDS_GRID); };
ProcNode node{prepareNode("Test")
.preparePort()
.invoke("fun()", procFun)
.attachAutomation (autoFun)
.completePort()
.build()};
// invoke with a random »nominal Time« <10s with ms granularity
Time theTime{rani(10'000),0};
int res = invokeRenderNode (node, theTime);
// for verification: quantise the given Time into SMPTE timecode;
QuTime qantTime (theTime, SECONDS_GRID);
CHECK (res == SmpteTC(qantTime).secs);
// Explanation: since the param-functor quantises into a 1-second grid
// and the given time is below 1 minute, the seconds field
// of SMPTE Timecode should match the parameter value
}
@ -135,7 +173,7 @@ namespace test {
/** @test TODO
* @todo WIP 12/24 define implement
* @todo WIP 12/24 🔁 define implement
*/
void
build_ParamNode()

View file

@ -36,7 +36,6 @@
using lib::Several;
using lib::makeSeveral;
using lib::time::Time;
using lib::time::FSecs;
using lib::time::FrameNr;
using lib::test::showType;
using std::make_tuple;

View file

@ -88462,8 +88462,9 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1733577482085" ID="ID_932666491" MODIFIED="1733577589840" TEXT="Turnout-System: Funktionsweise testen">
<linktarget COLOR="#406cd3" DESTINATION="ID_932666491" ENDARROW="Default" ENDINCLINATION="-128;9;" ID="Arrow_ID_983808840" SOURCE="ID_494911945" STARTARROW="None" STARTINCLINATION="-353;-26;"/>
<icon BUILTIN="pencil"/>
<node CREATED="1733580248780" ID="ID_1698079544" MODIFIED="1733588646642" TEXT="mit nominal Time erzeugen">
<arrowlink COLOR="#482eb7" DESTINATION="ID_855223653" ENDARROW="Default" ENDINCLINATION="-595;39;" ID="Arrow_ID_342943763" STARTARROW="None" STARTINCLINATION="-57;-58;"/>
<node CREATED="1733580248780" ID="ID_1698079544" MODIFIED="1736045190074" TEXT="mit nominal Time erzeugen">
<arrowlink COLOR="#482eb7" DESTINATION="ID_855223653" ENDARROW="Default" ENDINCLINATION="-595;39;" ID="Arrow_ID_342943763" STARTARROW="None" STARTINCLINATION="-65;-160;"/>
<linktarget COLOR="#4f70b3" DESTINATION="ID_1698079544" ENDARROW="Default" ENDINCLINATION="100;348;" ID="Arrow_ID_822714910" SOURCE="ID_1699433498" STARTARROW="None" STARTINCLINATION="356;24;"/>
<node CREATED="1733580331065" ID="ID_1781432590" MODIFIED="1733584790502" TEXT="Testen mit Time-Grid!">
<richcontent TYPE="NOTE"><html>
<head/>
@ -89071,11 +89072,24 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
<node COLOR="#338800" CREATED="1735267723607" ID="ID_1259281567" MODIFIED="1735267745234" TEXT="&#xbb;Dropper&#xab; Parameter-Funktor">
<icon BUILTIN="button_ok"/>
</node>
<node COLOR="#338800" CREATED="1736045055753" ID="ID_1150839986" MODIFIED="1736045070707" TEXT="Zeit-basierter Automations-Funktor">
<icon BUILTIN="button_ok"/>
<node COLOR="#435e98" CREATED="1736045125473" ID="ID_1699433498" MODIFIED="1736045190073" TEXT="einfache Zeit-Quantisierung verwendet...">
<arrowlink COLOR="#4f70b3" DESTINATION="ID_1698079544" ENDARROW="Default" ENDINCLINATION="100;348;" ID="Arrow_ID_822714910" STARTARROW="None" STARTINCLINATION="356;24;"/>
<icon BUILTIN="idea"/>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1733531449614" ID="ID_481525559" MODIFIED="1734059241149" TEXT="speziell auch Anlegen einer Parameter-Node">
<linktarget COLOR="#406cd3" DESTINATION="ID_481525559" ENDARROW="Default" ENDINCLINATION="-140;9;" ID="Arrow_ID_55724637" SOURCE="ID_1678162572" STARTARROW="None" STARTINCLINATION="-358;-24;"/>
<node COLOR="#435e98" CREATED="1736045192550" ID="ID_921759191" MODIFIED="1736045206577" TEXT="kann sogar SMPTE-Timecode f&#xfc;r Verifikation verwenden">
<icon BUILTIN="ksmiletris"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1733531449614" ID="ID_481525559" MODIFIED="1736042355078" TEXT="speziell auch Anlegen einer &#xbb;Param-Agent-Node&#xab;">
<linktarget COLOR="#406cd3" DESTINATION="ID_481525559" ENDARROW="Default" ENDINCLINATION="-155;9;" ID="Arrow_ID_55724637" SOURCE="ID_1678162572" STARTARROW="None" STARTINCLINATION="-358;-24;"/>
<linktarget COLOR="#fe433f" DESTINATION="ID_481525559" ENDARROW="Default" ENDINCLINATION="1490;75;" ID="Arrow_ID_570772162" SOURCE="ID_1587342377" STARTARROW="None" STARTINCLINATION="-530;-37;"/>
<icon BUILTIN="pencil"/>
<node COLOR="#435e98" CREATED="1736042374897" ID="ID_1791150840" LINK="#ID_1305712041" MODIFIED="1736042398278" TEXT="Implementierungs-Details im NodeFeed_test dokumentiert">
<icon BUILTIN="info"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1713821606607" ID="ID_492497884" MODIFIED="1733527499249" TEXT="NodeDevel_test">
@ -98041,7 +98055,7 @@ StM_bind(Builder&lt;R1&gt; b1, Extension&lt;R1,R2&gt; extension)
<font NAME="SansSerif" SIZE="10"/>
</node>
</node>
<node CREATED="1735181577102" ID="ID_524332742" MODIFIED="1735318266930" TEXT="attachAutomation(AUTO)">
<node COLOR="#435e98" CREATED="1735181577102" ID="ID_524332742" MODIFIED="1736044954879" TEXT="attachAutomation(AUTO)">
<arrowlink COLOR="#8f2ea4" DESTINATION="ID_972907747" ENDARROW="Default" ENDINCLINATION="887;-53;" ID="Arrow_ID_685087124" STARTARROW="None" STARTINCLINATION="-536;60;"/>
<node CREATED="1735181646685" HGAP="30" ID="ID_1875790841" MODIFIED="1735181809869" TEXT="zeitbasierte Funktion adaptieren (Zeit aus Turnoutsystem)">
<font NAME="SansSerif" SIZE="10"/>