summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-02-19 09:38:37 +0000
committerDavid Robillard <d@drobilla.net>2015-02-19 09:38:37 +0000
commit6672e5727516eea194ca278731280cd08f1d3937 (patch)
tree18805dfc887c4ec1b0c5b027d8ed37cd8221bb9a
parent765929f0b2194171c7f793dc01e227830533c420 (diff)
downloadlilv-6672e5727516eea194ca278731280cd08f1d3937.tar.gz
lilv-6672e5727516eea194ca278731280cd08f1d3937.tar.bz2
lilv-6672e5727516eea194ca278731280cd08f1d3937.zip
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
-rw-r--r--NEWS3
-rw-r--r--lilv/lilv.h16
-rw-r--r--src/state.c19
-rw-r--r--wscript2
4 files changed, 32 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 71d3c4d..43e369c 100644
--- a/NEWS
+++ b/NEWS
@@ -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);
}
}
diff --git a/wscript b/wscript
index b222bf0..8f546ea 100644
--- a/wscript
+++ b/wscript
@@ -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