lilv.state

class State

Types 1

classState

Snapshot of plugin state (presets, session save/restore).

A State is owned by the caller and freed in the destructor. Like other lilv objects, it keeps the World alive until the State is destroyed.

Most State operations need an LV2_URID_Map (and often Unmap). The host is responsible for providing those; lilv does not implement a map for you.

Fields
private LilvState * _cPtr
private World _world
Methods
LilvState * handle() @property @nogc nothrow
World world() @property @nogc nothrow
uint numProperties() @property @nogc nothrowNumber of properties in this state.
Node pluginUri() @propertyURI of the plugin this state applies to.
Node uri() @propertyState URI if set, or null.
string label() @propertyHuman-readable label, or null.
void label(string value) @propertySet a human-readable label for this state.
bool opEquals(Object o) const @nogc nothrowWhether two states are equivalent.
int setMetadata(uint key, const(void)[] value, uint type, StateFlags flags) @nogc nothrowSet a single metadata property on this state.
void emitPortValues(LilvSetPortValueFunc setValue, void * userData) @nogc nothrowEmit all port values in this state via a callback. Does not touch a live Instance; useful for hosts that apply ports themselves. Low overhead C callback version which is potentially real-time safe.
void emitPortValues(SetPortValueDelegate setValueDg)Emit all port values in this state via a callback. Does not touch a live Instance; useful for hosts that apply ports themselves. Uses a delegate which may result in GC allocation or exceptions. NOT...
void restore(Instance instance, LilvSetPortValueFunc setValue, void * userData, StateFlags flags, const(LV2_Feature *) * features = null) @nogc nothrowRestore this state onto a plugin instance. Low overhead C callback version which is potentially real-time safe.
void restore(Instance instance, SetPortValueDelegate setValueDg, StateFlags flags, Feature[] features = null)Restore this state onto a plugin instance. Uses a delegate instead of a C callback and dynamic array of Feature structures which may result in GC allocation and is NOT real-time safe.
int save(LV2_URID_Map * map, LV2_URID_Unmap * unmap, string uri, string dir, string filename)Save this state to a bundle directory / file on disk.
string toString(LV2_URID_Map * map, LV2_URID_Unmap * unmap, string uri = null, string baseUri = null)Serialize this state to a string (Turtle).
int deleteFromWorld() @nogc nothrowDelete the resources for this state from the World (saved bundle files, etc.). Returns: 0 on success
State fromWorld(World world, LV2_URID_Map * map, Node subject) staticLoad state from a resource already present in the World model.
State fromFile(World world, LV2_URID_Map * map, Node subject, string path) staticLoad state from a Turtle file.
State fromString(World world, LV2_URID_Map * map, string str) staticLoad state from a string previously produced by toString(). Params: world = Lilv world map = URID map str = The string state returned by toString() Returns: New State object or null on error
State fromInstance(Plugin plugin, Instance instance, LV2_URID_Map * map, string scratchDir, string copyDir, string linkDir, string saveDir, LilvGetPortValueFunc getValue, void * userData, StateFlags flags, const(LV2_Feature *) * features = null) staticSnapshot state from a live plugin instance.
State fromInstance(Plugin plugin, Instance instance, LV2_URID_Map * map, string scratchDir, string copyDir, string linkDir, string saveDir, GetPortValueDelegate getValueDg, StateFlags flags, Feature[] features = null) staticSnapshot state from a live plugin instance.
Constructors
this(LilvState * p, World world)Wrap an existing C state pointer (takes ownership). Params: p = C pointer returned by a lilv_state_new_* function world = World used to create the state
Destructors