Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
editor_assets.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5// Editor assets a plug-in binary declares: the scripted-UI entry file, its
6// theme file, the directories its script may load assets from, and the
7// embedded copy of the editor that a shipped image carries.
8//
9// The selection belongs to the plug-in target, not to the Pulp libraries it
10// links. `pulp_add_plugin(... UI_SCRIPT ...)` generates one small source for
11// each VST3, CLAP, AU, AAX, Standalone and ControlHost target, and
12// `pulp_use_kit_ui()` one for every format target that exists when it runs;
13// that source's static initializer calls `register_editor_assets()`. Every
14// editor path (ViewBridge in each adapter, the standalone window, the control
15// host) then reads the same runtime value, whichever translation unit builds
16// the editor.
17//
18// Two kinds of value live in one record:
19//
20// - The embedded editor: the script's bytes, the theme beside it, and the
21// asset files beside it, compiled into the image by the same helper. Every
22// build carries these, so a shipped plug-in never depends on a file outside
23// its own bundle, and the developer's directory is not a string in the binary.
24// - The on-disk paths: absolute build-machine paths a dev build
25// (`PULP_DEV_BUILD`) also records so a hot-reloading editor can watch the
26// file being edited. A release build records none. The paths are absolute
27// build-machine paths, so `UI_SCRIPT` is not applied to AUv3: an iOS app
28// extension cannot resolve them, and an AUv3 editor ships its script inside
29// the extension bundle instead.
30//
31// Registration runs at static-init time, so the record is POD: no heap, no
32// std::string, no logging. The byte arrays it points at are constant-initialized
33// in their own translation units, so the order in which those units initialize
34// cannot leave a dangling pointer here.
35
36namespace pulp::format {
37
42 const char* name;
43 const unsigned char* data;
44 std::size_t size;
45};
46
49 const char* script_path = nullptr;
51 const char* theme_path = nullptr;
53 const char* asset_roots = nullptr;
54
57 const char* script_name = nullptr;
60 const unsigned char* script = nullptr;
61 std::size_t script_size = 0;
63 const unsigned char* theme = nullptr;
64 std::size_t theme_size = 0;
67 const EmbeddedEditorFile* files = nullptr;
68 std::size_t file_count = 0;
69};
70
72bool declares_editor_assets(const EditorAssets& assets) noexcept;
73
75bool embeds_editor_script(const EditorAssets& assets) noexcept;
76
78void register_editor_assets(const EditorAssets& assets) noexcept;
79
82
88EditorAssets editor_assets_for(const char* plugin_id) noexcept;
89
97
100
101} // namespace pulp::format
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
EditorAssets registered_editor_assets() noexcept
The binary-wide record from register_editor_assets(), or an empty record.
bool declares_editor_assets(const EditorAssets &assets) noexcept
True when assets names a script, theme, or asset root, or embeds a script.
bool embeds_editor_script(const EditorAssets &assets) noexcept
True when assets carries an embedded entry script.
void register_editor_assets(const EditorAssets &assets) noexcept
Record this binary's editor assets. Static-init safe; last write wins.
void reset_editor_assets_for_testing() noexcept
Test-only: clear the binary-wide record. NOT for production use.
EditorAssets editor_assets_for(const char *plugin_id) noexcept
Editor assets for the plug-in with reverse-DNS id plugin_id.
void install_scripted_editor_builder() noexcept
Link and install the scripted editor builder (see scripted_editor_builder_slot() in editor_ui....
Definition editor_assets.hpp:47
const char * theme_path
Absolute path of the theme / design-token file. Null or empty: none.
Definition editor_assets.hpp:51
const EmbeddedEditorFile * files
Files embedded beside the script, resolved by the embedded editor in place of its script directory.
Definition editor_assets.hpp:67
const char * asset_roots
'|'-separated absolute directories the script may load assets from.
Definition editor_assets.hpp:53
std::size_t file_count
Definition editor_assets.hpp:68
std::size_t script_size
Definition editor_assets.hpp:61
const char * script_path
Absolute path of the scripted-UI entry file. Null or empty: none.
Definition editor_assets.hpp:49
const unsigned char * theme
The embedded theme override (JSON), or null/0 when the build had none.
Definition editor_assets.hpp:63
const unsigned char * script
The embedded entry script's bytes.
Definition editor_assets.hpp:60
std::size_t theme_size
Definition editor_assets.hpp:64
const char * script_name
File name of the embedded entry script (main.js), for diagnostics.
Definition editor_assets.hpp:57
One file embedded beside the editor script.
Definition editor_assets.hpp:41
const unsigned char * data
Definition editor_assets.hpp:43
const char * name
Definition editor_assets.hpp:42
std::size_t size
Definition editor_assets.hpp:44