aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-04-15 12:30:02 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-04-15 12:30:02 +0200
commitf4aadc4b16612bb46c139b53ec91c86eecb62804 (patch)
tree8d13dc9fc04c41a7bd68b524c0244134749444e2 /plugins
parent044e22754d0c5d7fdddf2dc4177a93777bed2626 (diff)
downloadsynthpod-f4aadc4b16612bb46c139b53ec91c86eecb62804.zip
synthpod-f4aadc4b16612bb46c139b53ec91c86eecb62804.tar.gz
synthpod-f4aadc4b16612bb46c139b53ec91c86eecb62804.tar.bz2
synthpod-f4aadc4b16612bb46c139b53ec91c86eecb62804.tar.xz
nk: always subscribe to canvas:graph patch ports.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/synthpod_common_nk.c88
1 files changed, 66 insertions, 22 deletions
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 13d84d9..7023036 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -1122,6 +1122,49 @@ _patch_subscription_remove(plughandle_t *handle, port_t *source_port)
}
}
+static param_t *
+_mod_param_find_by_property(mod_t *mod, LV2_URID property)
+{
+ DBG;
+ HASH_FOREACH(&mod->params, param_itr)
+ {
+ param_t *param = *param_itr;
+
+ if(param->property == property)
+ return param;
+ }
+ HASH_FOREACH(&mod->dynams, param_itr)
+ {
+ param_t *param = *param_itr;
+
+ if(param->property == property)
+ return param;
+ }
+
+ return NULL;
+}
+
+static bool
+_mod_subscription_is_persistent(plughandle_t *handle, mod_t *mod, port_t *port)
+{
+ DBG;
+ param_t *param = NULL;
+
+ if(port->type & PROPERTY_TYPE_PATCH)
+ {
+ param = param
+ ? param
+ : _mod_param_find_by_property(mod, handle->canvas.urid.Canvas_graph);
+
+ if(param)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static void
_mod_unsubscribe_all(plughandle_t *handle, mod_t *mod)
{
@@ -1130,11 +1173,33 @@ _mod_unsubscribe_all(plughandle_t *handle, mod_t *mod)
{
port_t *port = *port_itr;
+ if(_mod_subscription_is_persistent(handle, mod, port))
+ {
+ continue; // do not subscribe
+ }
+
_patch_subscription_remove(handle, port);
}
}
static void
+_mod_subscribe_persistent(plughandle_t *handle, mod_t *mod)
+{
+ DBG;
+ HASH_FOREACH(&mod->ports, port_itr)
+ {
+ port_t *port = *port_itr;
+
+ if(!_mod_subscription_is_persistent(handle, mod, port))
+ {
+ continue; // do not subscribe
+ }
+
+ _patch_subscription_add(handle, port);
+ }
+}
+
+static void
_mod_subscribe_all(plughandle_t *handle, mod_t *mod)
{
DBG;
@@ -1666,28 +1731,6 @@ _mod_port_find_by_index(mod_t *mod, uint32_t index)
}
static param_t *
-_mod_param_find_by_property(mod_t *mod, LV2_URID property)
-{
- DBG;
- HASH_FOREACH(&mod->params, param_itr)
- {
- param_t *param = *param_itr;
-
- if(param->property == property)
- return param;
- }
- HASH_FOREACH(&mod->dynams, param_itr)
- {
- param_t *param = *param_itr;
-
- if(param->property == property)
- return param;
- }
-
- return NULL;
-}
-
-static param_t *
_mod_dynam_find_by_property(mod_t *mod, LV2_URID property)
{
DBG;
@@ -3668,6 +3711,7 @@ _mod_init(plughandle_t *handle, mod_t *mod, const LilvPlugin *plug)
}
_set_module_idisp_subscription(handle, mod, 1);
+ _mod_subscribe_persistent(handle, mod); // e.g. canvas:graph
nk_pugl_post_redisplay(&handle->win); //FIXME
}