The host-facing factory-preset table for one plug-in instance. More...
#include <au_factory_presets.hpp>
Public Member Functions | |
| FactoryPresetTable ()=default | |
| ~FactoryPresetTable () | |
| FactoryPresetTable (const FactoryPresetTable &)=delete | |
| FactoryPresetTable & | operator= (const FactoryPresetTable &)=delete |
| void | bind (state::StateStore &store, const std::string &manufacturer, const std::string &plugin_name) |
| Bind to the plug-in's StateStore and identity, and scan the bundle the adapter was loaded from. | |
| void | set_directory (const std::filesystem::path &dir) |
| Re-point discovery at dir and rebuild the table. | |
| std::size_t | size () const noexcept |
| Number of factory presets the host can select. | |
| std::string | name_at (std::size_t index) const |
UTF-8 display name of preset index, or empty when out of range. | |
| bool | load (std::size_t index) |
Load preset index into the bound StateStore. | |
| const AUPreset * | preset_at (std::size_t index) const noexcept |
The canonical AUPreset for index, owned by this table. | |
| OSStatus | copy_presets (CFArrayRef *out_data) const |
| AUBase::GetPresets. | |
| state::PresetManager * | preset_manager () noexcept |
| The PresetManager behind the table, or null before bind. | |
The host-facing factory-preset table for one plug-in instance.
Holds the PresetManager the adapter loads through and the AUPreset records the AU v2 property surface hands out by pointer. Those records must outlive every array the host is holding, so the table rebuilds only when a caller re-points it — never in response to a host read.
|
default |
| pulp::format::au::FactoryPresetTable::~FactoryPresetTable | ( | ) |
|
delete |
| void pulp::format::au::FactoryPresetTable::bind | ( | state::StateStore & | store, |
| const std::string & | manufacturer, | ||
| const std::string & | plugin_name ) |
Bind to the plug-in's StateStore and identity, and scan the bundle the adapter was loaded from.
Safe to call with an identity whose bundle has no Presets folder: the table is then empty and the adapter reports no factory presets, which is what makes a host hide the menu.
| OSStatus pulp::format::au::FactoryPresetTable::copy_presets | ( | CFArrayRef * | out_data | ) | const |
AUBase::GetPresets.
Fills out_data with a CFArray of AUPreset* pointing into this table (the layout AU v2 hosts expect) and returns noErr; the caller owns the array. A null out_data is the host's "do you have any?" probe and returns noErr without allocating. Reports kAudioUnitErr_InvalidProperty when the plug-in ships none.
| bool pulp::format::au::FactoryPresetTable::load | ( | std::size_t | index | ) |
Load preset index into the bound StateStore.
False when the index is out of range, nothing is bound, or the file could not be read.
Deliberately does NOT take the adapter's StateRestoreGate: a preset carries parameter values only, so this writes the same atomics a host SetParameter writes and never calls Processor::deserialize_plugin_state(), which is the thing the gate exists to keep off a running render. If PresetManager::load ever grows a processor-state restore, this needs the gate and the callers need to hand it one.
Main thread only — it reads a file.
| std::string pulp::format::au::FactoryPresetTable::name_at | ( | std::size_t | index | ) | const |
UTF-8 display name of preset index, or empty when out of range.
|
delete |
|
noexcept |
The canonical AUPreset for index, owned by this table.
Null when out of range. Use this rather than the host's copy when making a preset current: the host may pass a name that is not ours.
|
inlinenoexcept |
The PresetManager behind the table, or null before bind.
| void pulp::format::au::FactoryPresetTable::set_directory | ( | const std::filesystem::path & | dir | ) |
Re-point discovery at dir and rebuild the table.
A plug-in that keeps its factory presets somewhere other than the default bundle folder calls this straight after construction; tests use it to stage a fixture.
|
inlinenoexcept |
Number of factory presets the host can select.