[LV2] How to load a LV2 preset stored in a Turtle file?

Robin Gareus robin at gareus.org
Mon Apr 30 04:27:22 PDT 2018

On 04/30/2018 12:29 PM, Sylvain Leroux wrote:

>> lilv_state_restore() does it all and uses serd/sord under the
>> hood. See http://drobilla.net/docs/lilv/
> I completely missed that.
> By reading http://lv2plug.in/ns/ext/state/state.html I though I had to
> provide the `store` and `retrieve` callbacks to the plug-in. But I
> (think I) realize now this was the low-level LV2 API, and `lilv` is
> hiding most of that complexity. 

Yes, liblilv does indeed abstract all that. Nice isn't it?

>> [...] 
>> For noise-repellent, you'll also have to add support for an LV2
>> URI map to lv2apply at the very least.
> If you may elaborate a little here...
> I've seen the LV2_URID_Map and LV2_URID_Unmap type used in the `lilv`
> API. I /supposed/ `LV2_URID_Map` was some kind of associative array,
> and `LV2_URID_Unmap` was probably the reverse mapping.

Yes. Since it is not efficient to deal with long URI strings like
the "uri-map" provides means to map URIs to numbers.

> Now, how is this specifically related to noise-repellent. To handle
> the vector of floats in the state maybe?

Correct. The "Vector", "Float" "Int" and the various identifiers in the
plugin state are URIs. They're mapped to integers to conveniently deal
with them.

That's done in

Later (in nrepel's savestate, restorestate) only the mapped IDs are used.


More information about the Devel mailing list