43#include <unordered_map>
52struct BakedParamMailbox;
53struct BakedParamNodeState;
54struct BakedCustomNodeRuntime;
55struct BakedSampleRegionRuntime;
64 std::vector<CustomNodeBakedParam>
params;
119 std::span<const GraphNode> nodes,
120 std::span<const Connection> connections,
121 const std::function<
const CustomNodeType*(std::string_view type_id,
int version)>&
122 resolve_custom = {});
133 std::function<void(
double sample_rate,
int max_block)>
prepare;
187 bool valid() const noexcept {
return mailbox_ !=
nullptr; }
208 explicit ParamInjector(std::shared_ptr<detail::BakedParamMailbox> mailbox)
noexcept;
209 void release() noexcept;
210 std::shared_ptr<
detail::BakedParamMailbox> mailbox_;
228 std::vector<Connection> connections,
232 std::string bundle_id,
241 std::unordered_map<NodeId, BakedCustomNodeBinding>
248 int input_channels,
int output_channels, std::string name,
249 std::string bundle_id,
250 std::unordered_map<NodeId, BakedCustomNodeBinding> custom_nodes,
251 std::vector<SampleRegionDefinition> sample_regions);
256 int input_channels,
int output_channels, std::string name,
257 std::string bundle_id,
258 std::unordered_map<NodeId, BakedCustomNodeBinding> custom_nodes,
259 std::vector<SampleRegionDefinition> sample_regions,
260 std::vector<SampleKernelDescriptor> sample_kernels);
266 return prepared_latency_samples_.load(std::memory_order_relaxed);
270 return sample_region_parameter_contract_;
273 return sample_region_parameter_binding_.get();
291 int input_channels,
int output_channels, std::string name,
292 std::string bundle_id,
293 std::unordered_map<NodeId, BakedCustomNodeBinding> custom_nodes,
299 void prepare_param_injection();
303 std::vector<GraphNode> nodes_;
304 std::vector<Connection> conns_;
308 std::vector<std::unique_ptr<std::atomic<float>>> gains_;
309 std::unordered_map<NodeId, std::size_t> gain_index_;
319 std::vector<PluginBindingContext> plugin_ctx_;
325 std::unordered_map<NodeId, std::unique_ptr<detail::BakedCustomNodeRuntime>> custom_nodes_;
326 std::vector<CustomBindingContext> custom_ctx_;
332 std::vector<float> input_alias_scratch_;
333 std::vector<float*> input_alias_ptrs_;
336 std::string bundle_id_;
338 std::unique_ptr<SampleRegionParameterBinding> sample_region_parameter_binding_;
339 std::unique_ptr<detail::BakedSampleRegionRuntime> sample_region_runtime_;
340 int input_channels_ = 2;
341 int output_channels_ = 2;
342 int prepared_max_block_ = 0;
345 std::atomic<int> prepared_latency_samples_{0};
346 bool prepared_ =
false;
366 const std::vector<CustomNodeType>& custom_types);
388 return registrations_;
392 struct ConstructionKey {};
393 BakedTypeRegistry(std::vector<BakedTypeRegistration> registrations, ConstructionKey)
394 : registrations_(
std::move(registrations)) {}
396 std::vector<BakedTypeRegistration> registrations_;
413 const std::vector<BakedTypeRegistration>& registrations);
427template <
typename Registry>
430 Registry&& registry) {
Non-owning view over multi-channel audio sample data.
Definition buffer.hpp:30
BakedGraphProcessor(std::vector< GraphNode > nodes, std::vector< Connection > connections, int input_channels, int output_channels, std::string name, std::string bundle_id, std::unordered_map< NodeId, BakedCustomNodeBinding > custom_nodes={})
void define_parameters(pulp::state::StateStore &store) override
Register parameters with the state store.
pulp::format::PluginDescriptor descriptor() const override
Return the plugin's metadata. Called once during initialization.
const SampleRegionParameterContract & sample_region_parameter_contract() const noexcept
Definition baked_graph_processor.hpp:269
const SampleRegionParameterBinding * sample_region_parameter_binding() const noexcept
Definition baked_graph_processor.hpp:272
void prepare(const pulp::format::PrepareContext &context) override
Prepare for processing.
static LowerResult create_with_sample_regions(std::vector< GraphNode > nodes, std::vector< Connection > connections, int input_channels, int output_channels, std::string name, std::string bundle_id, std::unordered_map< NodeId, BakedCustomNodeBinding > custom_nodes, std::vector< SampleRegionDefinition > sample_regions, std::vector< SampleKernelDescriptor > sample_kernels)
~BakedGraphProcessor() override
int latency_samples() const override
Latency in samples introduced by this processor (default 0).
Definition baked_graph_processor.hpp:265
ParamInjector claim_param_injection(NodeId node) noexcept
static LowerResult create_with_sample_regions(std::vector< GraphNode > nodes, std::vector< Connection > connections, int input_channels, int output_channels, std::string name, std::string bundle_id, std::unordered_map< NodeId, BakedCustomNodeBinding > custom_nodes, std::vector< SampleRegionDefinition > sample_regions)
void process(pulp::audio::BufferView< float > &audio_output, const pulp::audio::BufferView< const float > &audio_input, pulp::midi::MidiBuffer &midi_in, pulp::midi::MidiBuffer &midi_out, const pulp::format::ProcessContext &context) override
Process one buffer of audio.
Definition baked_graph_processor.hpp:380
const std::vector< BakedTypeRegistration > & registrations() const noexcept
Definition baked_graph_processor.hpp:387
static BakedTypeRegistry from(std::vector< BakedTypeRegistration > registrations)
Definition baked_graph_processor.hpp:383
BakedTypeRegistry()=delete
Definition baked_graph_processor.hpp:177
InjectStatus inject(const state::ParameterEvent &event) noexcept
bool valid() const noexcept
Definition baked_graph_processor.hpp:187
InjectStatus inject(const state::ParameterEventQueue &events) noexcept
friend class BakedGraphProcessor
Definition baked_graph_processor.hpp:207
ParamInjector() noexcept=default
Definition sample_region_parameters.hpp:80
Definition sample_region_parameters.hpp:28
Definition signal_graph_runtime.hpp:83
Collection of timestamped MIDI events within a single audio buffer period.
Definition buffer.hpp:31
Definition parameter_event_queue.hpp:82
Centralized parameter storage with lock-free value access.
Definition store.hpp:164
Definition child_process_manager.hpp:18
Definition graph_runtime_buffer_assignment.hpp:8
std::uint32_t NodeId
Definition graph_types.hpp:7
Definition baked_codec.hpp:158
LowerResult load_baked_registered(std::span< const std::uint8_t > bytes, const BakedTrust &trust, const BakedTypeRegistry ®istry)
Bounded event contracts shared by host ingress and graph-authored nodes.
Definition anticipation_eligibility.hpp:9
@ None
Definition anticipation_eligibility.hpp:22
BakedPlanLoadResult load_baked_plan(std::span< const std::uint8_t > bytes, const BakedTrust &trust, const std::vector< BakedTypeRegistration > ®istrations)
LowerResult load_baked(std::span< const std::uint8_t > bytes, const BakedTrust &trust, const std::vector< CustomNodeType > &custom_types)
LowerResult bake(const SignalGraph &graph)
std::function< void(audio::BufferView< float > &output, const audio::BufferView< const float > &input, int num_samples, const BakedParamView ¶ms)> CustomNodeParamProcessFn
Definition custom_node_type.hpp:61
LowerRejectReason
Definition baked_graph_processor.hpp:68
@ NonAudioLaneNotLowerable
Definition baked_graph_processor.hpp:78
@ NotPrepared
Definition baked_graph_processor.hpp:70
@ None
Definition baked_graph_processor.hpp:69
@ CustomTransportNotLowerable
Definition baked_graph_processor.hpp:76
@ HostedPluginNotSelfContained
Definition baked_graph_processor.hpp:72
@ NotExecutorEligible
Definition baked_graph_processor.hpp:71
@ ParameterContractMismatch
Definition baked_graph_processor.hpp:84
@ CustomNotYetLowerable
Definition baked_graph_processor.hpp:73
@ CodecRejected
Definition baked_graph_processor.hpp:79
@ StatefulCustomNotYetLoadable
Definition baked_graph_processor.hpp:82
@ CustomNotLowerable
Definition baked_graph_processor.hpp:75
@ SpectralPersistenceUnsupported
Definition baked_graph_processor.hpp:85
LowerabilityProof lowerability_of(std::span< const GraphNode > nodes, std::span< const Connection > connections, const std::function< const CustomNodeType *(std::string_view type_id, int version)> &resolve_custom={})
std::function< void(audio::BufferView< float > &output, const audio::BufferView< const float > &input, int num_samples)> CustomNodeProcessFn
Definition custom_node_type.hpp:24
BakePlanResult bake_to_plan(const SignalGraph &graph)
std::uint32_t SampleRegionId
Definition sample_region_proof.hpp:13
InjectStatus
Definition baked_graph_processor.hpp:155
@ InvalidHandle
Definition baked_graph_processor.hpp:160
@ PartialOverflow
Definition baked_graph_processor.hpp:157
@ Ok
Definition baked_graph_processor.hpp:156
Definition analyzer_provider.hpp:12
Definition prepare_resources.hpp:102
Process context — passed every audio callback with transport state.
Definition process_context.hpp:89
Definition baked_graph_processor.hpp:437
NodeId offending_node
Definition baked_graph_processor.hpp:441
bool accepted
Definition baked_graph_processor.hpp:439
LowerRejectReason reason
Definition baked_graph_processor.hpp:440
std::string message
Definition baked_graph_processor.hpp:442
std::optional< BakedPlan > plan
Definition baked_graph_processor.hpp:438
Definition baked_graph_processor.hpp:144
std::function< int(double)> latency_samples
Definition baked_graph_processor.hpp:148
CustomNodeLifecycle lifecycle
Definition baked_graph_processor.hpp:146
BakedCustomParamBinding params
Definition baked_graph_processor.hpp:147
CustomNodeProcessFn process
Definition baked_graph_processor.hpp:145
Definition baked_graph_processor.hpp:62
CustomNodeParamProcessFn process
Definition baked_graph_processor.hpp:63
std::vector< CustomNodeBakedParam > params
Definition baked_graph_processor.hpp:64
Definition baked_graph_processor.hpp:403
SampleRegionId offending_region
Definition baked_graph_processor.hpp:407
std::optional< BakedPlan > plan
Definition baked_graph_processor.hpp:404
bool accepted
Definition baked_graph_processor.hpp:405
NodeId offending_node
Definition baked_graph_processor.hpp:408
std::string message
Definition baked_graph_processor.hpp:409
LowerRejectReason reason
Definition baked_graph_processor.hpp:406
Definition baked_codec.hpp:188
Definition baked_graph_processor.hpp:373
SampleKernelDescriptor sample
Definition baked_graph_processor.hpp:375
CustomNodeType block
Definition baked_graph_processor.hpp:374
Definition baked_graph_processor.hpp:132
std::function< void(double sample_rate, int max_block)> prepare
Definition baked_graph_processor.hpp:133
std::function< bool()> restore_state
Definition baked_graph_processor.hpp:138
std::function< void()> reset
Definition baked_graph_processor.hpp:134
Definition custom_node_type.hpp:90
Definition baked_graph_processor.hpp:91
bool accepted
Definition baked_graph_processor.hpp:93
std::string message
Definition baked_graph_processor.hpp:96
LowerRejectReason reason
Definition baked_graph_processor.hpp:94
NodeId offending_node
Definition baked_graph_processor.hpp:95
std::unique_ptr< pulp::format::Processor > processor
Definition baked_graph_processor.hpp:92
Definition baked_graph_processor.hpp:106
NodeId offending_node
Definition baked_graph_processor.hpp:108
LowerRejectReason reason
Definition baked_graph_processor.hpp:109
bool accepted
Definition baked_graph_processor.hpp:107
std::string message
Definition baked_graph_processor.hpp:110
Definition signal_graph_executor_routing.hpp:38
Definition custom_node_type.hpp:386
Definition parameter_event_queue.hpp:34