From 6672e5727516eea194ca278731280cd08f1d3937 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 19 Feb 2015 09:38:37 +0000 Subject: Add lilv_state_emit_port_values() for special port value handling. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5586 a436a847-0d15-0410-975c-d299462d15a1 --- src/state.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/state.c') diff --git a/src/state.c b/src/state.c index 03ad488..f75a2bb 100644 --- a/src/state.c +++ b/src/state.c @@ -398,6 +398,17 @@ lilv_state_new_from_instance(const LilvPlugin* plugin, return state; } +LILV_API void +lilv_state_emit_port_values(const LilvState* state, + LilvSetPortValueFunc set_value, + void* user_data) +{ + for (uint32_t i = 0; i < state->num_values; ++i) { + const PortValue* val = &state->values[i]; + set_value(val->symbol, user_data, val->value, val->size, val->type); + } +} + LILV_API void lilv_state_restore(const LilvState* state, LilvInstance* instance, @@ -410,7 +421,7 @@ lilv_state_restore(const LilvState* state, LILV_ERROR("lilv_state_restore() called on NULL state\n"); return; } - + LV2_State_Map_Path map_path = { (LilvState*)state, abstract_path, absolute_path }; LV2_Feature map_feature = { LV2_STATE__mapPath, &map_path }; @@ -430,11 +441,7 @@ lilv_state_restore(const LilvState* state, free(sfeatures); if (set_value) { - for (uint32_t i = 0; i < state->num_values; ++i) { - const PortValue* val = &state->values[i]; - set_value(val->symbol, user_data, - val->value, val->size, val->type); - } + lilv_state_emit_port_values(state, set_value, user_data); } } -- cgit v1.2.1