aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2019-02-26 19:20:17 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2019-02-26 19:20:17 +0100
commit5de5ec462319197ac19ea1a08f187e82f68cc10f (patch)
treea204306e34a6f2a9d4c3ab8e380067c3b6534afc
parente1e18d03d51fd646fd78ac0a5c194ddcbdd5c340 (diff)
downloadprops.lv2-5de5ec462319197ac19ea1a08f187e82f68cc10f.tar.xz
add props_get method to API.
-rw-r--r--VERSION2
-rw-r--r--props.h56
2 files changed, 57 insertions, 1 deletions
diff --git a/VERSION b/VERSION
index 5950146..2317587 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.103
+0.1.105
diff --git a/props.h b/props.h
index 9aad570..01b47e6 100644
--- a/props.h
+++ b/props.h
@@ -152,6 +152,11 @@ props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
// rt-safe
static inline void
+props_get(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);
// rt-safe
@@ -306,6 +311,44 @@ _props_patch_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
}
static inline LV2_Atom_Forge_Ref
+_props_patch_get(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
+ props_impl_t *impl, int32_t sequence_num)
+{
+ LV2_Atom_Forge_Frame obj_frame;
+
+ LV2_Atom_Forge_Ref ref = lv2_atom_forge_frame_time(forge, frames);
+
+ if(ref)
+ ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.patch_get);
+ {
+ if(props->urid.subject) // is optional
+ {
+ if(ref)
+ ref = lv2_atom_forge_key(forge, props->urid.patch_subject);
+ if(ref)
+ ref = lv2_atom_forge_urid(forge, props->urid.subject);
+ }
+
+ if(sequence_num) // is optional
+ {
+ if(ref)
+ ref = lv2_atom_forge_key(forge, props->urid.patch_sequence);
+ if(ref)
+ ref = lv2_atom_forge_int(forge, sequence_num);
+ }
+
+ if(ref)
+ ref = lv2_atom_forge_key(forge, props->urid.patch_property);
+ if(ref)
+ ref = lv2_atom_forge_urid(forge, impl->property);
+ }
+ if(ref)
+ lv2_atom_forge_pop(forge, &obj_frame);
+
+ return ref;
+}
+
+static inline LV2_Atom_Forge_Ref
_props_patch_error(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
int32_t sequence_num)
{
@@ -779,6 +822,19 @@ props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
}
static inline void
+props_get(props_t *props, LV2_Atom_Forge *forge, uint32_t frames,
+ LV2_URID property, LV2_Atom_Forge_Ref *ref)
+{
+ props_impl_t *impl = _props_impl_get(props, property);
+
+ if(impl)
+ {
+ if(*ref && !impl->def->hidden) //TODO use patch:sequenceNumber
+ *ref = _props_patch_get(props, forge, frames, impl, 0);
+ }
+}
+
+static inline void
props_stash(props_t *props, LV2_URID property)
{
props_impl_t *impl = _props_impl_get(props, property);