MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Forma.hpp File Reference

Factory free functions for the Forma surface system. More...

#include "Bridge.hpp"
#include "Plot/Plot.hpp"
#include "Surface.hpp"
+ Include dependency graph for Forma.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  MayaFlux
 Main namespace for the Maya Flux audio engine.
 
namespace  MayaFlux::Buffers
 
namespace  MayaFlux::Core
 
namespace  MayaFlux::Nodes
 Contains the node-based computational processing system components.
 
namespace  MayaFlux::Portal
 
namespace  MayaFlux::Portal::Forma
 
namespace  MayaFlux::Portal::Forma::internal
 
namespace  MayaFlux::Vruta
 

Functions

BridgeMayaFlux::Portal::Forma::bridge ()
 Return the application-level Bridge instance.
 
template<typename V >
requires std::is_trivially_copyable_v<V> && (!std::ranges::range<V>)
std::shared_ptr< Buffers::FormaBufferMayaFlux::Portal::Forma::create_buffer (std::shared_ptr< Core::Window > window, const V &vertex, Graphics::PrimitiveTopology topology=Graphics::PrimitiveTopology::TRIANGLE_STRIP)
 
template<typename V >
requires std::ranges::contiguous_range<V> && std::is_trivially_copyable_v<std::ranges::range_value_t<V>>
std::shared_ptr< Buffers::FormaBufferMayaFlux::Portal::Forma::create_buffer (std::shared_ptr< Core::Window > window, const V &vertices, Graphics::PrimitiveTopology topology=Graphics::PrimitiveTopology::TRIANGLE_STRIP)
 Construct, register, and immediately submit a FormaBuffer from vertices.
 
std::shared_ptr< Buffers::FormaBufferMayaFlux::Portal::Forma::create_buffer (std::shared_ptr< Core::Window > window, Graphics::PrimitiveTopology topology, const std::string &texture_binding={})
 Construct and register a FormaBuffer without creating a Mapped<T>.
 
std::shared_ptr< Buffers::FormaBufferMayaFlux::Portal::Forma::create_buffer (std::shared_ptr< Core::Window > window, Graphics::PrimitiveTopology topology, std::vector< std::pair< std::string, std::shared_ptr< Core::VKImage > > > additional_textures)
 Construct and register a FormaBuffer with additional texture bindings.
 
std::shared_ptr< Buffers::FormaBufferMayaFlux::Portal::Forma::internal::create_buffer_impl (std::shared_ptr< Core::Window > window, size_t capacity, Graphics::PrimitiveTopology topology, const std::string &texture_binding={}, std::vector< std::pair< std::string, std::shared_ptr< Core::VKImage > > > additional_textures={})
 Core buffer construction — capacity-explicit path for internal use.
 
template<typename T >
Mapped< T > MayaFlux::Portal::Forma::create_element (Layer &layer, std::shared_ptr< Core::Window > window, GeometryFn< T > geom, T initial, Graphics::PrimitiveTopology topology=Graphics::PrimitiveTopology::TRIANGLE_STRIP, size_t capacity=internal::k_capacity_bytes, std::function< float(T)> project={})
 Build a FormaBuffer, register it, construct a Mapped<T>, and add the element to layer.
 
template<typename T >
Mapped< T > MayaFlux::Portal::Forma::create_element (Surface &surface, GeometryFn< T > geom, T initial, Graphics::PrimitiveTopology topology=Graphics::PrimitiveTopology::TRIANGLE_STRIP, std::function< float(T)> project={})
 Build a FormaBuffer, register it, construct a Mapped<T>, add the element to surface's layer, and register it with the application Bridge.
 
std::pair< std::shared_ptr< Layer >, std::shared_ptr< Context > > MayaFlux::Portal::Forma::create_layer (const std::shared_ptr< Core::Window > &window, std::string name)
 Construct a Layer and a Context wired to window.
 
Surface MayaFlux::Portal::Forma::create_surface (std::shared_ptr< Core::Window > window, std::string name)
 Construct a Surface, creating Layer and Context internally.
 
bool MayaFlux::Portal::Forma::initialize (std::shared_ptr< Nodes::NodeGraphManager > node_graph_manager, std::shared_ptr< Buffers::BufferManager > buffer_manager, std::shared_ptr< Vruta::TaskScheduler > scheduler, std::shared_ptr< Vruta::EventManager > event_manager, std::shared_ptr< Core::WindowManager > window_manager)
 Store engine-level references for use by all subsequent Forma calls.
 
void MayaFlux::Portal::Forma::inspect (const std::shared_ptr< Buffers::Buffer > &buf)
 Open a dedicated window inspecting a single Buffer and its processing chain.
 
void MayaFlux::Portal::Forma::inspect (const std::shared_ptr< Nodes::Network::NodeNetwork > &net)
 Open a dedicated window inspecting a NodeNetwork.
 
void MayaFlux::Portal::Forma::inspect (const std::shared_ptr< Nodes::Node > &node)
 Open a dedicated window inspecting a single Node and its modulator tree.
 
void MayaFlux::Portal::Forma::inspect (const std::shared_ptr< Vruta::Event > &ev, std::string_view name={})
 Open a dedicated window inspecting a single Event.
 
void MayaFlux::Portal::Forma::inspect_buffers ()
 Open or show the BufferManager inspection window.
 
void MayaFlux::Portal::Forma::inspect_events ()
 Open or show the EventManager inspection window.
 
void MayaFlux::Portal::Forma::inspect_node_graph ()
 Open or show the NodeGraphManager inspection window.
 
void MayaFlux::Portal::Forma::inspect_scheduler ()
 Open or show the TaskScheduler inspection window.
 
InspectorMayaFlux::Portal::Forma::inspector ()
 Access the Forma introspection subsystem.
 
bool MayaFlux::Portal::Forma::is_initialized ()
 Whether initialize() has been called successfully.
 
std::pair< Mapped< std::shared_ptr< Kakshya::PlotContainer > >, SurfaceMayaFlux::Portal::Forma::plot (std::string title, uint32_t width, uint32_t height, std::shared_ptr< Kakshya::PlotContainer > container, Plot::SeriesSpec spec)
 Create a live plot in a new window.
 
void MayaFlux::Portal::Forma::shutdown ()
 Release stored references.
 

Variables

constexpr size_t MayaFlux::Portal::Forma::internal::k_capacity_bytes = 4096
 

Detailed Description

Factory free functions for the Forma surface system.

Call initialize() once after engine startup to store BufferManager, TaskScheduler, and EventManager references. Subsequent factory calls require only the arguments that legitimately vary per call (Window, geometry function, initial value). This matches the Portal::Text and Portal::Graphics initialization contracts.

Typical sequence:

Portal::Forma::initialize(buffer_manager, scheduler, event_manager);
auto [layer, ctx] = Forma::create_layer(window, "hud");
auto el = Forma::create_element<float>(
*layer, window, geom_fn, 0.5f);
auto bridge = Forma::create_bridge();
bridge.bind(el.state, envelope);
bridge.write(el.state, compute_proc, offsetof(PC, cutoff));
ctx->on_press(el.element.id, IO::MouseButtons::LEFT,
[](uint32_t, glm::vec2){});
void write(std::shared_ptr< MappedState< T > > state, std::function< void(std::span< const float >)> sink)
Definition Bridge.hpp:129
void bind(uint32_t id, std::shared_ptr< Nodes::Node > node, std::function< float(double)> project={})
Drive element value from a Node's output each frame.
Definition Bridge.cpp:38

Definition in file Forma.hpp.