21 std::filesystem::path
path;
26 std::vector<std::string>
tags;
64 const std::string& plugin_name);
74 bool save(
const std::string& name,
const std::string& folder =
"");
81 bool load(
const std::filesystem::path& path);
88 std::optional<std::vector<ParamSetting>>
read_values(
const std::filesystem::path& path)
const;
98 std::optional<PresetInfo>
import_file(
const std::filesystem::path& source);
186 factory_dir_ = std::move(dir);
187 cache_valid_ =
false;
192 std::string manufacturer_;
193 std::string plugin_name_;
194 std::filesystem::path user_dir_;
195 std::filesystem::path factory_dir_;
196 std::filesystem::path content_data_root_;
197 std::string content_plugin_id_;
198 std::vector<std::string> content_capabilities_;
199 std::vector<std::string> content_kinds_;
202 std::string current_name_;
203 bool unsaved_changes_ =
false;
205 std::vector<PresetInfo> cached_presets_;
206 bool cache_valid_ =
false;
208 void scan_directory(
const std::filesystem::path& dir,
bool is_factory,
209 std::vector<PresetInfo>& out)
const;
210 void ensure_user_dir();
211 static std::filesystem::path platform_presets_root();
bool load(const std::filesystem::path &path)
Load a preset by file path.
void set_content_data_root(std::filesystem::path data_root)
Override the content data root.
std::optional< PresetInfo > import_file(const std::filesystem::path &source)
Import a preset file from an external location into user presets.
const std::string & current_preset_name() const
The currently loaded preset (empty if unsaved/modified).
Definition preset_manager.hpp:145
void refresh()
Rescan preset directories (call after external changes).
bool has_unsaved_changes() const
True if parameters have changed since the last load/save.
Definition preset_manager.hpp:149
void mark_as_changed()
Definition preset_manager.hpp:150
bool save(const std::string &name, const std::string &folder="")
Save current state as a named preset in the user presets folder.
bool delete_preset(const PresetInfo &preset)
Delete a user preset file. Factory presets cannot be deleted.
std::vector< PresetInfo > factory_presets() const
Get factory presets only.
std::vector< PresetInfo > user_presets() const
Get user presets only.
std::filesystem::path factory_presets_dir() const
The factory presets directory (inside the plugin bundle).
Definition preset_manager.hpp:174
std::function< void()> on_list_changed
Called after the preset list changes (save/delete/rename/import).
Definition preset_manager.hpp:166
std::optional< std::vector< ParamSetting > > read_values(const std::filesystem::path &path) const
Read the parameter values a preset file holds without applying them.
bool rename(const PresetInfo &preset, const std::string &new_name)
Rename a user preset.
void set_content_manifest(const ContentCapabilityManifest &manifest)
Opt into content discovery from a parsed pulp.plugin-runtime.v1 manifest embedded in the plugin/app b...
void set_content_capabilities(std::vector< std::string > capabilities)
Limit installed content packs to matching capabilities such as content.presets.v1.
void set_factory_presets_dir(std::filesystem::path dir)
Point factory-preset discovery at a directory.
Definition preset_manager.hpp:185
std::vector< PresetInfo > content_presets() const
Get installed content-pack presets matching this plugin's content capabilities.
void mark_as_saved()
Definition preset_manager.hpp:151
bool load_next()
Load the next preset in the list. Wraps around.
std::vector< PresetInfo > all_presets() const
Get all presets (factory + user), sorted alphabetically.
PresetManager(StateStore &store, const std::string &manufacturer, const std::string &plugin_name)
Construct with a StateStore and plugin identity for path resolution.
void set_current_preset_name(const std::string &name)
Definition preset_manager.hpp:146
bool load(const PresetInfo &preset)
Load a preset from a PresetInfo (sets all parameter values).
std::function< void(const PresetInfo &)> on_preset_loaded
Called after a preset is loaded.
Definition preset_manager.hpp:163
void set_content_preset_source(ContentPresetSource source)
Install the reader that lists installed content-pack presets.
std::filesystem::path user_presets_dir() const
The user presets directory.
Definition preset_manager.hpp:171
bool load_previous()
Load the previous preset in the list. Wraps around.
void set_content_plugin_id(std::string plugin_id)
Opt into installed content-pack discovery for this plugin id.
Centralized parameter storage with lock-free value access.
Definition store.hpp:164
The capabilities a plugin declares before consuming installed content packs, and the pulp....
SequencerStateChannel is the audio-safe transport for a plugin's structured NON-parameter state: the ...
Definition audio_device_manager.hpp:48
std::function< std::vector< PresetInfo >( const ContentCapabilityManifest &manifest, const std::filesystem::path &data_root)> ContentPresetSource
Lists installed content-pack presets for a plugin's content manifest.
Definition preset_manager.hpp:38
uint32_t ParamID
Unique parameter identifier, stable across plugin versions.
Definition parameter.hpp:55
Capabilities a plugin declares before consuming installed content packs.
Definition content_capability_manifest.hpp:19
One parameter value read from a preset file.
Definition preset_manager.hpp:30
float value
Definition preset_manager.hpp:32
Metadata for a single preset file.
Definition preset_manager.hpp:19
std::string name
Display name (filename without extension).
Definition preset_manager.hpp:20
std::filesystem::path path
Full path to the preset file.
Definition preset_manager.hpp:21
bool is_factory
True if this is a bundled factory preset.
Definition preset_manager.hpp:22
std::string author
Optional author name.
Definition preset_manager.hpp:24
std::string folder
Relative folder path (empty for root).
Definition preset_manager.hpp:23
std::string description
Optional description.
Definition preset_manager.hpp:25
std::vector< std::string > tags
Optional category tags.
Definition preset_manager.hpp:26