aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-15 16:37:43 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-15 16:37:43 +0200
commitaf975984315e1eb424b387c1351f2c0b42690f46 (patch)
tree4949316c67d3c7c32e0e868794e17d62fc795c72
parentcd21a40540e9b5a6c931bb28ac323f86078c831f (diff)
downloadsherlock.lv2-af975984315e1eb424b387c1351f2c0b42690f46.tar.xz
change props_set, add props_stash.
-rw-r--r--props.h26
-rw-r--r--test/props.c12
2 files changed, 24 insertions, 14 deletions
diff --git a/props.h b/props.h
index f5b9f9a..f944719 100644
--- a/props.h
+++ b/props.h
@@ -220,8 +220,13 @@ props_advance(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
const LV2_Atom_Object *obj, LV2_Atom_Forge_Ref *ref);
// rt-safe
-static inline LV2_Atom_Forge_Ref
-props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, LV2_URID property);
+static inline void
+props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, LV2_URID property,
+ LV2_Atom_Forge_Ref *ref);
+
+// rt-safe
+static inline void
+props_stash(props_t *props, LV2_URID property);
// non-rt
static inline LV2_State_Status
@@ -1126,18 +1131,27 @@ props_advance(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
return 0; // did not handle a patch event
}
-static inline LV2_Atom_Forge_Ref
-props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, LV2_URID property)
+static inline void
+props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, LV2_URID property,
+ LV2_Atom_Forge_Ref *ref)
{
props_impl_t *impl = _props_impl_search(props, property);
if(impl)
{
_props_stash(props, impl);
- return _props_get(props, forge, frames, impl);
+ if(*ref)
+ *ref = _props_get(props, forge, frames, impl);
}
+}
- return 1; // we have not written anything, ref thus is set to 'good'
+static inline void
+props_stash(props_t *props, LV2_URID property)
+{
+ props_impl_t *impl = _props_impl_search(props, property);
+
+ if(impl)
+ _props_stash(props, impl);
}
static inline LV2_State_Status
diff --git a/test/props.c b/test/props.c
index 0f8e0c5..2744ecb 100644
--- a/test/props.c
+++ b/test/props.c
@@ -146,8 +146,7 @@ _intercept_dyn1(void *data, LV2_Atom_Forge *forge, int64_t frames,
{
handle->dyn.val2 = handle->dyn.val1 * 2;
- if(handle->ref)
- handle->ref = props_set(&handle->props, forge, frames, handle->urid.dyn2);
+ props_set(&handle->props, forge, frames, handle->urid.dyn2, &handle->ref);
}
}
@@ -163,8 +162,7 @@ _intercept_dyn3(void *data, LV2_Atom_Forge *forge, int64_t frames,
{
handle->dyn.val4 = handle->dyn.val3 * 2;
- if(handle->ref)
- handle->ref = props_set(&handle->props, forge, frames, handle->urid.dyn4);
+ props_set(&handle->props, forge, frames, handle->urid.dyn4, &handle->ref);
}
}
@@ -180,8 +178,7 @@ _intercept_stat1(void *data, LV2_Atom_Forge *forge, int64_t frames,
{
handle->stat.val2 = handle->stat.val1 * 2;
- if(handle->ref)
- handle->ref = props_set(&handle->props, forge, frames, handle->urid.stat2);
+ props_set(&handle->props, forge, frames, handle->urid.stat2, &handle->ref);
}
}
@@ -197,8 +194,7 @@ _intercept_stat3(void *data, LV2_Atom_Forge *forge, int64_t frames,
{
handle->stat.val4 = handle->stat.val3 * 2;
- if(handle->ref)
- handle->ref = props_set(&handle->props, forge, frames, handle->urid.stat4);
+ props_set(&handle->props, forge, frames, handle->urid.stat4, &handle->ref);
}
}