Avoid duplicated LV2_State_{Map,Free}_Path features to
eg. lilv_state_new_from_instance(), when and if already provided by the caller/host (eg. qtractor). Resolves promised qtractor method to bundle all SFZ <region> files to an archive/zip (*.qtz) session file, an old feature applicable to LV2 plugins. See also: https://github.com/rncbc/qtractor/issues/427
This commit is contained in:
parent
2a45d4b9ec
commit
35bc2ab618
1 changed files with 12 additions and 6 deletions
|
|
@ -1482,15 +1482,18 @@ restore(LV2_Handle instance,
|
||||||
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
||||||
|
|
||||||
LV2_State_Map_Path *map_path = NULL;
|
LV2_State_Map_Path *map_path = NULL;
|
||||||
LV2_State_Free_Path *free_path = &sfizz_State_Free_Path;
|
LV2_State_Free_Path *free_path = NULL;
|
||||||
for (const LV2_Feature *const *f = features; *f; ++f)
|
for (const LV2_Feature *const *f = features; *f; ++f)
|
||||||
{
|
{
|
||||||
if (!strcmp((*f)->URI, LV2_STATE__mapPath))
|
if (!map_path && !strcmp((*f)->URI, LV2_STATE__mapPath))
|
||||||
map_path = (LV2_State_Map_Path *)(**f).data;
|
map_path = (LV2_State_Map_Path *)(**f).data;
|
||||||
else if (!strcmp((*f)->URI, LV2_STATE__freePath))
|
else if (!free_path && !strcmp((*f)->URI, LV2_STATE__freePath))
|
||||||
free_path = (LV2_State_Free_Path *)(**f).data;
|
free_path = (LV2_State_Free_Path *)(**f).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!free_path)
|
||||||
|
free_path = &sfizz_State_Free_Path;
|
||||||
|
|
||||||
// Set default values
|
// Set default values
|
||||||
self->last_keyswitch = -1;
|
self->last_keyswitch = -1;
|
||||||
sfizz_lv2_get_default_sfz_path(self, self->sfz_file_path, MAX_PATH_SIZE);
|
sfizz_lv2_get_default_sfz_path(self, self->sfz_file_path, MAX_PATH_SIZE);
|
||||||
|
|
@ -1622,15 +1625,18 @@ save(LV2_Handle instance,
|
||||||
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
sfizz_plugin_t *self = (sfizz_plugin_t *)instance;
|
||||||
|
|
||||||
LV2_State_Map_Path *map_path = NULL;
|
LV2_State_Map_Path *map_path = NULL;
|
||||||
LV2_State_Free_Path *free_path = &sfizz_State_Free_Path;
|
LV2_State_Free_Path *free_path = NULL;
|
||||||
for (const LV2_Feature *const *f = features; *f; ++f)
|
for (const LV2_Feature *const *f = features; *f; ++f)
|
||||||
{
|
{
|
||||||
if (!strcmp((*f)->URI, LV2_STATE__mapPath))
|
if (!map_path && !strcmp((*f)->URI, LV2_STATE__mapPath))
|
||||||
map_path = (LV2_State_Map_Path *)(**f).data;
|
map_path = (LV2_State_Map_Path *)(**f).data;
|
||||||
else if (!strcmp((*f)->URI, LV2_STATE__freePath))
|
else if (!free_path && !strcmp((*f)->URI, LV2_STATE__freePath))
|
||||||
free_path = (LV2_State_Free_Path *)(**f).data;
|
free_path = (LV2_State_Free_Path *)(**f).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!free_path)
|
||||||
|
free_path = &sfizz_State_Free_Path;
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
// Save the file path
|
// Save the file path
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue