Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
anticipation_subgraph.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <span>
7#include <vector>
8
9namespace pulp::host {
10
11struct GraphNode;
12struct Connection;
13
14// A standalone, renderable graph carved out of a larger one: the anticipation
15// partition's interior, plus a SINGLE synthesized AudioOutput sink whose input
16// ports are the distinct boundary output ports, so the whole thing renders
17// through the ordinary executor (build_executor_snapshot + process_routed) and
18// its output bus carries exactly the boundary signals the live graph needs — each
19// on its own channel. The interior GraphNodes are COPIED verbatim (plugin slots,
20// gain, ports preserved), so the same plugin instances render here — ownership of
21// those instances across the ahead/live boundary is the renderer's concern, not
22// this extraction's. NOTE: this does not check interior executor-eligibility. A
23// null-slot Plugin interior node is executor-ineligible, and a Custom interior
24// node — though executor-eligible in general — would make the anticipation
25// renderer's build_executor_snapshot call reject the sub-graph because that call
26// passes no Custom-binding storage; either way that gate belongs to the renderer
27// slice.
29 std::vector<GraphNode> nodes; // interior nodes, then the one sink
30 std::vector<Connection> connections; // internal edges, then source->sink edges
31
32 // One entry per captured boundary port, in OUTPUT-BUS CHANNEL ORDER: the
33 // output at index i carries the original interior port (source_node,
34 // source_port) on output-bus channel i (the sink's input port i). `sink_node`
35 // is the same synthesized AudioOutput id for every entry. The renderer maps
36 // each live boundary edge to the output that carries its source's signal.
42 std::vector<Output> outputs;
43 bool ok = false;
44
45 bool renders_anything() const { return ok && !outputs.empty(); }
46};
47
48// Build the renderable sub-graph for a partition: copy the interior nodes, copy
49// the connections internal to the interior, and synthesize one AudioOutput sink
50// with one input port per DISTINCT boundary output port (source_node,
51// source_port). The fresh sink id is above every existing node id, so it cannot
52// collide with the source graph.
53// Deterministic; allocation-bounded. Returns ok=false if `partition` is not ok or
54// references a node absent from `nodes` (it should not, having been built from the
55// same graph). The interior carries no feedback edges (6a excludes feedback
56// endpoints), so every internal edge is feedforward and every boundary edge leaves
57// the interior forward — the sub-graph is acyclic and self-contained.
59 std::span<const GraphNode> nodes, std::span<const Connection> connections,
60 const AnticipationPartition& partition);
61
62} // namespace pulp::host
std::uint32_t NodeId
Definition graph_types.hpp:7
std::uint32_t PortIndex
Definition graph_types.hpp:8
Bounded event contracts shared by host ingress and graph-authored nodes.
Definition anticipation_eligibility.hpp:9
AnticipationSubgraph build_anticipation_subgraph(std::span< const GraphNode > nodes, std::span< const Connection > connections, const AnticipationPartition &partition)
Definition anticipation_partition.hpp:31
Definition anticipation_subgraph.hpp:37
PortIndex source_port
Definition anticipation_subgraph.hpp:39
NodeId source_node
Definition anticipation_subgraph.hpp:38
NodeId sink_node
Definition anticipation_subgraph.hpp:40
Definition anticipation_subgraph.hpp:28
std::vector< Connection > connections
Definition anticipation_subgraph.hpp:30
bool ok
Definition anticipation_subgraph.hpp:43
bool renders_anything() const
Definition anticipation_subgraph.hpp:45
std::vector< GraphNode > nodes
Definition anticipation_subgraph.hpp:29
std::vector< Output > outputs
Definition anticipation_subgraph.hpp:42
Definition signal_graph_connection.hpp:18
Definition signal_graph_node.hpp:126