aboutsummaryrefslogtreecommitdiff
path: root/osc_inspector.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-03-02 21:36:35 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-03-02 21:36:35 +0100
commit35cef1000931430bd386565afcd7be1443956c6e (patch)
tree7c7e72f0df5f7a0795ca96311d58cddb6d5713c1 /osc_inspector.c
parent5ee440092342550add72a62f01d8f5e9e8bd9633 (diff)
downloadsherlock.lv2-35cef1000931430bd386565afcd7be1443956c6e.tar.xz
overhaul midi/osc inspector plugin/ui.
* show frame offset and period size.
Diffstat (limited to 'osc_inspector.c')
-rw-r--r--osc_inspector.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/osc_inspector.c b/osc_inspector.c
index 0ead8f6..1655bc5 100644
--- a/osc_inspector.c
+++ b/osc_inspector.c
@@ -32,6 +32,7 @@ struct _handle_t {
LV2_Atom_Forge forge;
osc_forge_t oforge;
+ uint64_t offset;
};
static LV2_Handle
@@ -87,7 +88,7 @@ run(LV2_Handle instance, uint32_t nsamples)
handle_t *handle = (handle_t *)instance;
uint32_t capacity;
LV2_Atom_Forge *forge = &handle->forge;
- LV2_Atom_Forge_Frame frame [2];
+ LV2_Atom_Forge_Frame frame [3];
LV2_Atom_Forge_Ref ref;
// size of input sequence
@@ -103,11 +104,20 @@ run(LV2_Handle instance, uint32_t nsamples)
// forge whole sequence as single event
capacity = handle->notify->atom.size;
lv2_atom_forge_set_buffer(forge, (uint8_t *)handle->notify, capacity);
+
+ bool has_osc = false;
+
ref = lv2_atom_forge_sequence_head(forge, &frame[0], 0);
if(ref)
ref = lv2_atom_forge_frame_time(forge, 0);
if(ref)
- ref = lv2_atom_forge_sequence_head(forge, &frame[1], 0);
+ ref = lv2_atom_forge_tuple(forge, &frame[1]);
+ if(ref)
+ ref = lv2_atom_forge_long(forge, handle->offset);
+ if(ref)
+ ref = lv2_atom_forge_int(forge, nsamples);
+ if(ref)
+ ref = lv2_atom_forge_sequence_head(forge, &frame[2], 0);
// only serialize OSC events to UI
LV2_ATOM_SEQUENCE_FOREACH(handle->control_in, ev)
@@ -117,6 +127,7 @@ run(LV2_Handle instance, uint32_t nsamples)
if( osc_atom_is_bundle(&handle->oforge, obj)
|| osc_atom_is_message(&handle->oforge, obj) )
{
+ has_osc = true;
if(ref)
ref = lv2_atom_forge_frame_time(forge, ev->time.frames);
if(ref)
@@ -127,11 +138,18 @@ run(LV2_Handle instance, uint32_t nsamples)
}
if(ref)
+ lv2_atom_forge_pop(forge, &frame[2]);
+ if(ref)
lv2_atom_forge_pop(forge, &frame[1]);
if(ref)
lv2_atom_forge_pop(forge, &frame[0]);
else
lv2_atom_sequence_clear(handle->notify);
+
+ if(!has_osc)
+ lv2_atom_sequence_clear(handle->notify);
+
+ handle->offset += nsamples;
}
static void