[LV2] jalv hacking

Hanspeter Portner ventosus at airpost.net
Sat Aug 29 10:11:32 PDT 2015


On 29.08.2015 17:30, Hermann Meyer wrote:
> So what, lets save a state file form the preset to load, and I try:
> 
>>     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);
>>                 const char* set =  lilv_node_as_string(label);
>>                 if (strcmp
>> (set,row.get_value(psets.col_label).c_str()) == 0) {
>>                     state = lilv_state_new_from_world(world, &map,
>> preset);
>>  lilv_state_save(world,&map,&unmap,state,NULL,"tmp/","state.ttl");
>>                 }
>>                 lilv_nodes_free(labels);
>>             }
>>    }
> 
> and fail. I tried the very same inside of jalv, hacking the required
> functions in, but, no avail.
> The saved state file remains empty, and jalv segfault, while it isn't a
> problem to load the same state  on startup when I didn't try to save it
> to file but just load it from the pointer (see my requested feature on
> dev.drobilla.net)

Here a wild guess:

from lilv.h:1223 (v0.20)
@param save_dir Directory of files created by plugin during save (or
 NULL). If the state will be saved, this should be the bundle directory
 later passed to lilv_state_save.

There may be a directory path mismatch, as 'lilv_state_from_world'
cannot know that (and where) you want to save the state.

'lilv_state_save' apart from writing the 'state.ttl' and 'manifest.ttl'
also seems to do some file linking based on the above mentioned path.

> 
> Now this is the point, were I need help, How the heck could I save a
> statefile from a LilvState* state pionter which otherwise work well, but
> is loaded with lilv_state_new_from_world() while the plugin itself isn't
> loaded.

Does this workaround work any better?
* 'lilv_state_new_from_world'
* 'lilv_state_to_string'
* 'fwrite'

'lilv_state_to_string' does obviously not do any such file linking and
thus cannot handle custom plugin state files.

Hp


More information about the Devel mailing list