MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ register_element() [1/2]

template<typename T >
void MayaFlux::Portal::Forma::Bridge::register_element ( Mapped< T >  mapped,
std::function< float(T)>  project = {} 
)
inline

Register a fully constructed Mapped<T> and own its sync loop.

Delegates record and reader/writer setup to the existing register_element overload, then spawns a per-frame GraphicsRoutine that calls mapped.sync(). The routine is stored in outbound_tasks and cancelled by unbind().

mapped must outlive the Bridge registration.

Template Parameters
TMappedState value type.
Parameters
mappedFully constructed Mapped<T>, typically from create_element.
projectOptional T -> float projection for outbound readers. Identity cast used if empty.

Definition at line 349 of file Bridge.hpp.

349 {})
350 {
351 register_element(mapped.state, mapped.element.id, mapped.element.buffer, std::move(project));
352 spawn_sync(mapped.element.id, [m = std::move(mapped)]() mutable { m.sync(); });
353 }
void register_element(std::shared_ptr< MappedState< T > > state, uint32_t id, std::shared_ptr< Buffers::FormaBuffer > buffer, std::function< float(T)> project={})
Register a MappedState<T> so that MappedState overloads and outbound bindings can resolve to the corr...
Definition Bridge.hpp:280
void spawn_sync(uint32_t id, std::function< void()> sync_fn)
Spawn a per-frame GraphicsRoutine that calls sync_fn each tick.
Definition Bridge.cpp:368