diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | lilv/lilv.h | 16 | ||||
-rw-r--r-- | src/state.c | 19 | ||||
-rw-r--r-- | wscript | 2 |
4 files changed, 32 insertions, 8 deletions
@@ -2,6 +2,7 @@ lilv (0.21.1) unstable; * Fix loading files with spaces in their path * Add lilv_file_uri_parse() for correct URI to path conversion + * Add lilv_state_emit_port_values() for special port value handling * Expose lilv_world_load_specifications() and lilv_world_load_plugin_classes() * Tolerate passing NULL to lilv_state_restore() @@ -11,7 +12,7 @@ lilv (0.21.1) unstable; * Windows fixes (thanks John Emmas) * Minor documentation improvements - -- David Robillard <d@drobilla.net> Sun, 08 Feb 2015 00:21:46 -0500 + -- David Robillard <d@drobilla.net> Thu, 19 Feb 2015 02:35:18 -0500 lilv (0.20.0) stable; diff --git a/lilv/lilv.h b/lilv/lilv.h index 66f6d00..2248df2 100644 --- a/lilv/lilv.h +++ b/lilv/lilv.h @@ -1369,6 +1369,22 @@ typedef void (*LilvSetPortValueFunc)(const char* port_symbol, uint32_t type); /** + Enumerate the port values in a state snapshot. + @param state The state to retrieve port values from. + @param set_value A function to receive port values. + @param user_data User data to pass to `set_value`. + + This function is a subset of lilv_state_restore() that only fires the + `set_value` callback and does not directly affect a plugin instance. This + is useful in hosts that need to retrieve the port values in a state snapshot + for special handling. +*/ +LILV_API void +lilv_state_emit_port_values(const LilvState* state, + LilvSetPortValueFunc set_value, + void* user_data); + +/** Restore a plugin instance from a state snapshot. @param state The state to restore, which must apply to the correct plugin. @param instance An instance of the plugin `state` applies to, or NULL. diff --git a/src/state.c b/src/state.c index 03ad488..f75a2bb 100644 --- a/src/state.c +++ b/src/state.c @@ -399,6 +399,17 @@ lilv_state_new_from_instance(const LilvPlugin* plugin, } 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, LilvSetPortValueFunc set_value, @@ -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); } } @@ -12,7 +12,7 @@ import waflib.Logs as Logs # major increment <=> incompatible changes # minor increment <=> compatible changes (additions) # micro increment <=> no interface changes -LILV_VERSION = '0.21.1' +LILV_VERSION = '0.21.2' LILV_MAJOR_VERSION = '0' # Mandatory waf variables |