aboutsummaryrefslogtreecommitdiff
path: root/vm.h
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-22 08:36:32 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-22 08:36:32 +0100
commite524c7f5bd0994401a8bb0dd66fc30e88c84d727 (patch)
treec83a1bdddd5cfa59aebfcd5809c6565ad57d368b /vm.h
parente5530df06577e3bc454cb62371cc587dd68074a7 (diff)
downloadvm.lv2-e524c7f5bd0994401a8bb0dd66fc30e88c84d727.tar.xz
handle rand separate from transport.
Diffstat (limited to 'vm.h')
-rw-r--r--vm.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/vm.h b/vm.h
index b35c439..84b138a 100644
--- a/vm.h
+++ b/vm.h
@@ -50,6 +50,7 @@
#include <props.lv2/props.h>
+typedef enum _vm_status_t vm_status_t;
typedef enum _opcode_enum_t opcode_enum_t;
typedef enum _command_enum_t command_enum_t;
typedef struct _command_t command_t;
@@ -69,6 +70,12 @@ struct _vm_api_impl_t {
LV2_URID urid;
};
+enum _vm_status_t {
+ VM_STATUS_STATIC = (0 << 0),
+ VM_STATUS_HAS_TIME = (1 << 1),
+ VM_STATUS_HAS_RAND = (1 << 2),
+};
+
enum _opcode_enum_t{
OP_NOP = 0,
@@ -582,14 +589,14 @@ vm_serialize(vm_api_impl_t *impl, LV2_Atom_Forge *forge, const command_t *cmds)
return ref;
}
-static inline bool
+static inline vm_status_t
vm_deserialize(vm_api_impl_t *impl, LV2_Atom_Forge *forge,
command_t *cmds, uint32_t size, const LV2_Atom *body)
{
command_t *cmd = cmds;
memset(cmds, 0x0, sizeof(command_t)*ITEMS_MAX);
- bool is_dynamic = false;
+ vm_status_t state = VM_STATUS_STATIC;
LV2_ATOM_TUPLE_BODY_FOREACH(body, size, item)
{
@@ -633,10 +640,13 @@ vm_deserialize(vm_api_impl_t *impl, LV2_Atom_Forge *forge,
|| (cmd->op == OP_BPM)
|| (cmd->op == OP_FRAME)
//|| (cmd->op == OP_FPS) // is constant
- || (cmd->op == OP_SPEED)
- || (cmd->op == OP_RAND) )
+ || (cmd->op == OP_SPEED) )
+ {
+ state |= VM_STATUS_HAS_TIME;
+ }
+ else if(cmd->op == OP_RAND)
{
- is_dynamic = true;
+ state |= VM_STATUS_HAS_RAND;
}
}
else
@@ -650,7 +660,7 @@ vm_deserialize(vm_api_impl_t *impl, LV2_Atom_Forge *forge,
break;
}
- return is_dynamic;
+ return state;
}
#endif // _VM_LV2_H