[LV2] jalv hacking

Hermann Meyer brummer- at web.de
Sat Aug 29 22:33:38 PDT 2015

Am 29.08.2015 um 23:28 schrieb David Robillard:
> On Sat, 2015-08-29 at 17:30 +0200, Hermann Meyer wrote:
>> Hi
>> In my previous post I announced jalv.select, to be a little GUI to
>> select a plugin from a list and select the jalv interpreter to use.
>> Now, I've extended this GUI to select a preset to load on start-up with
>> jalv. Unfortunately this requires a patch to jalv so that jalv could
>> load a preset from URI or from preset::label.
> A label is not an identifier.  An individual preset may have many (e.g.
> translations), several presets may have the same label, and they may
> change over time for the "same" preset.
> Loading via label might be a convenient feature for users to use
> directly, but any tool should definitely use the URI to identify the
> preset to be loaded.
>> However, enough of hitting on the pipe, I'm accept that, and started to
>> try to use the state load interface which jalv comes with.
>> Two problems occur, when working with presets.
>> I could create a preset menu with
>>> void PresetList::create_preset_list(Glib::ustring id, const
>>> LilvPlugin* plug, LilvWorld* world) {
>>>      LilvNodes* presets = lilv_plugin_get_related(plug,
>>>        lilv_new_uri(world,LV2_PRESETS__Preset));
>>>      presetStore->clear();
>>>      LILV_FOREACH(nodes, i, presets) {
>>>          const LilvNode* preset = lilv_nodes_get(presets, i);
>>>          lilv_world_load_resource(world, preset);
>>>          LilvNodes* labels = lilv_world_find_nodes(
>>>            world, preset, lilv_new_uri(world, LILV_NS_RDFS "label"), NULL);
>>>          if (labels) {
>>>              const LilvNode* label = lilv_nodes_get_first(labels);
>>>              Glib::ustring set =  lilv_node_as_string(label);
>>>              row = *(presetStore->append());
>>>              row[psets.col_label]=set;
>>>              row[psets.col_uri] = lilv_node_as_uri(preset);
>>>              lilv_nodes_free(labels);
>>>          } else {
>>>              fprintf(stderr, "Preset <%s> has no rdfs:label\n",
>>>                      lilv_node_as_string(lilv_nodes_get(presets, i)));
>>>          }
>>>      }
>>>      lilv_nodes_free(presets);
>>>      create_preset_menu(id);
>>> }
>> and get access to the preset label and uri. Non of that get accepted by
>> jalv. Jalv only accept state file/path to load. to bad, I didn't know
>> the path of the preset files, and, on top of it preset files contain a
>> couple of presets. So no avail.
> I do not understand the problem here.  You clearly need to, and did
> attempt to, add a feature to Jalv for this.  Trying to kludge around it
> because I didn't immediately accept your patch within 13 days is
> ridiculous.
No, that's hacking. ;-)

> Add a command line option to Jalv to load a preset on startup by URI,
> and have your tool use that to specify the appropriate preset.  All the
> code necessary to load a preset by URI is already present in Jalv
> (jalv_apply_preset).

jalv_apply_preset fails in that state, as jalv seems to need to load the 
resources first.
However, identify a preset by label have the advance that the option 
could be used to set the windows tittle. The uri could be fetched by the 
label identifier and then used.
Indeed, it could be done the other way round, but I fail to see the big 
Could one plugin really have multiple presets with the same label? I've 
tried that, and wasn't able to do so.
Just, that may be, I didn't know, if
                 const LilvNode* label = lilv_nodes_get_first(labels);
                 const char* set =  lilv_node_as_string(label);

only return the first translation of the label, than it's bad to use it.
But, as far I can see, the label is part of the uri anyway,

More information about the Devel mailing list