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
36
namespace
pulp::format
{
37
41
struct
EmbeddedEditorFile
{
42
const
char
*
name
;
43
const
unsigned
char
*
data
;
44
std::size_t
size
;
45
};
46
47
struct
EditorAssets
{
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
72
bool
declares_editor_assets
(
const
EditorAssets
& assets)
noexcept
;
73
75
bool
embeds_editor_script
(
const
EditorAssets
& assets)
noexcept
;
76
78
void
register_editor_assets
(
const
EditorAssets
& assets)
noexcept
;
79
81
EditorAssets
registered_editor_assets
() noexcept;
82
88
EditorAssets
editor_assets_for
(const
char
* plugin_id) noexcept;
89
96
void
install_scripted_editor_builder
() noexcept;
97
99
void
reset_editor_assets_for_testing
() noexcept;
100
101
}
// namespace pulp::format
pulp::format
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition
aax_editor.hpp:31
pulp::format::registered_editor_assets
EditorAssets registered_editor_assets() noexcept
The binary-wide record from register_editor_assets(), or an empty record.
pulp::format::declares_editor_assets
bool declares_editor_assets(const EditorAssets &assets) noexcept
True when assets names a script, theme, or asset root, or embeds a script.
pulp::format::embeds_editor_script
bool embeds_editor_script(const EditorAssets &assets) noexcept
True when assets carries an embedded entry script.
pulp::format::register_editor_assets
void register_editor_assets(const EditorAssets &assets) noexcept
Record this binary's editor assets. Static-init safe; last write wins.
pulp::format::reset_editor_assets_for_testing
void reset_editor_assets_for_testing() noexcept
Test-only: clear the binary-wide record. NOT for production use.
pulp::format::editor_assets_for
EditorAssets editor_assets_for(const char *plugin_id) noexcept
Editor assets for the plug-in with reverse-DNS id plugin_id.
pulp::format::install_scripted_editor_builder
void install_scripted_editor_builder() noexcept
Link and install the scripted editor builder (see scripted_editor_builder_slot() in editor_ui....
pulp::format::EditorAssets
Definition
editor_assets.hpp:47
pulp::format::EditorAssets::theme_path
const char * theme_path
Absolute path of the theme / design-token file. Null or empty: none.
Definition
editor_assets.hpp:51
pulp::format::EditorAssets::files
const EmbeddedEditorFile * files
Files embedded beside the script, resolved by the embedded editor in place of its script directory.
Definition
editor_assets.hpp:67
pulp::format::EditorAssets::asset_roots
const char * asset_roots
'|'-separated absolute directories the script may load assets from.
Definition
editor_assets.hpp:53
pulp::format::EditorAssets::file_count
std::size_t file_count
Definition
editor_assets.hpp:68
pulp::format::EditorAssets::script_size
std::size_t script_size
Definition
editor_assets.hpp:61
pulp::format::EditorAssets::script_path
const char * script_path
Absolute path of the scripted-UI entry file. Null or empty: none.
Definition
editor_assets.hpp:49
pulp::format::EditorAssets::theme
const unsigned char * theme
The embedded theme override (JSON), or null/0 when the build had none.
Definition
editor_assets.hpp:63
pulp::format::EditorAssets::script
const unsigned char * script
The embedded entry script's bytes.
Definition
editor_assets.hpp:60
pulp::format::EditorAssets::theme_size
std::size_t theme_size
Definition
editor_assets.hpp:64
pulp::format::EditorAssets::script_name
const char * script_name
File name of the embedded entry script (main.js), for diagnostics.
Definition
editor_assets.hpp:57
pulp::format::EmbeddedEditorFile
One file embedded beside the editor script.
Definition
editor_assets.hpp:41
pulp::format::EmbeddedEditorFile::data
const unsigned char * data
Definition
editor_assets.hpp:43
pulp::format::EmbeddedEditorFile::name
const char * name
Definition
editor_assets.hpp:42
pulp::format::EmbeddedEditorFile::size
std::size_t size
Definition
editor_assets.hpp:44
core
format
include
pulp
format
editor_assets.hpp
Generated by
1.15.0