Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::au::FactoryPresetTable Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ FactoryPresetTable() [1/2]

pulp::format::au::FactoryPresetTable::FactoryPresetTable ( )
default

◆ ~FactoryPresetTable()

pulp::format::au::FactoryPresetTable::~FactoryPresetTable ( )

◆ FactoryPresetTable() [2/2]

pulp::format::au::FactoryPresetTable::FactoryPresetTable ( const FactoryPresetTable & )
delete

Member Function Documentation

◆ bind()

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.

◆ copy_presets()

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.

◆ load()

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.

◆ name_at()

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.

◆ operator=()

FactoryPresetTable & pulp::format::au::FactoryPresetTable::operator= ( const FactoryPresetTable & )
delete

◆ preset_at()

const AUPreset * pulp::format::au::FactoryPresetTable::preset_at ( std::size_t index) const
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.

◆ preset_manager()

state::PresetManager * pulp::format::au::FactoryPresetTable::preset_manager ( )
inlinenoexcept

The PresetManager behind the table, or null before bind.

◆ set_directory()

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.

◆ size()

std::size_t pulp::format::au::FactoryPresetTable::size ( ) const
inlinenoexcept

Number of factory presets the host can select.


The documentation for this class was generated from the following file: