aboutsummaryrefslogtreecommitdiff
path: root/osc_inspector.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-09-09 22:48:36 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-09-09 22:48:36 +0200
commit74f4b5baa5fd88a2c7e7e99406d735236a95e01b (patch)
tree7782ea88189c149badd5d70d5bea3817f7f350bf /osc_inspector.c
parent0be87ee75218602fc2243c46ed4e84ca8acd3e7d (diff)
downloadsherlock.lv2-74f4b5baa5fd88a2c7e7e99406d735236a95e01b.tar.xz
atom_inspector: prototype log tracing.
Diffstat (limited to 'osc_inspector.c')
-rw-r--r--osc_inspector.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/osc_inspector.c b/osc_inspector.c
index 3225de8..3982fa0 100644
--- a/osc_inspector.c
+++ b/osc_inspector.c
@@ -26,6 +26,10 @@ typedef struct _handle_t handle_t;
struct _handle_t {
LV2_URID_Map *map;
+ LV2_URID_Unmap *unmap;
+ LV2_Log_Log *log;
+ LV2_Log_Logger logger;
+
const LV2_Atom_Sequence *control;
craft_t through;
craft_t notify;
@@ -52,16 +56,25 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
return NULL;
for(i=0; features[i]; i++)
+ {
if(!strcmp(features[i]->URI, LV2_URID__map))
- handle->map = (LV2_URID_Map *)features[i]->data;
+ handle->map = features[i]->data;
+ else if(!strcmp(features[i]->URI, LV2_URID__unmap))
+ handle->unmap = features[i]->data;
+ else if(!strcmp(features[i]->URI, LV2_LOG__log))
+ handle->log = features[i]->data;
+ }
- if(!handle->map)
+ if(!handle->map || !handle->unmap)
{
- fprintf(stderr, "%s: Host does not support urid:map\n", descriptor->URI);
+ fprintf(stderr, "%s: Host does not support urid:(un)map\n", descriptor->URI);
free(handle);
return NULL;
}
+ if(handle->log)
+ lv2_log_logger_init(&handle->logger, handle->map, handle->log);
+
handle->time_position = handle->map->map(handle->map->handle, LV2_TIME__Position);
handle->time_frame = handle->map->map(handle->map->handle, LV2_TIME__frame);
lv2_osc_urid_init(&handle->osc_urid, handle->map);
@@ -146,8 +159,13 @@ run(LV2_Handle instance, uint32_t nsamples)
if(through->ref)
lv2_atom_forge_pop(&through->forge, &through->frame[0]);
else
+ {
lv2_atom_sequence_clear(through->seq);
+ if(handle->log)
+ lv2_log_trace(&handle->logger, "through buffer overflow\n");
+ }
+
bool has_event = notify->seq->atom.size > sizeof(LV2_Atom_Sequence_Body);
if(notify->ref)
@@ -183,8 +201,13 @@ run(LV2_Handle instance, uint32_t nsamples)
if(notify->ref)
lv2_atom_forge_pop(&notify->forge, &notify->frame[0]);
else
+ {
lv2_atom_sequence_clear(notify->seq);
+ if(handle->log)
+ lv2_log_trace(&handle->logger, "notify buffer overflow\n");
+ }
+
if(!has_event) // don't send anything
lv2_atom_sequence_clear(notify->seq);