aboutsummaryrefslogtreecommitdiff
path: root/sandbox_ui.lv2
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2017-08-21 17:59:15 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2017-08-21 17:59:15 +0200
commitfc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c (patch)
tree85a1e213d638c30dafb9532f99ed619d4d6cbcdf /sandbox_ui.lv2
parent80424d14b72e7a3fe1f6474bd501735cdf384163 (diff)
downloadsynthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.zip
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.gz
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.bz2
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.xz
fix draining broken in last commit.
Diffstat (limited to 'sandbox_ui.lv2')
-rw-r--r--sandbox_ui.lv2/sandbox_io.h25
-rw-r--r--sandbox_ui.lv2/sandbox_master.h2
-rw-r--r--sandbox_ui.lv2/sandbox_slave.c4
3 files changed, 21 insertions, 10 deletions
diff --git a/sandbox_ui.lv2/sandbox_io.h b/sandbox_ui.lv2/sandbox_io.h
index 5dfcd98..b02660c 100644
--- a/sandbox_ui.lv2/sandbox_io.h
+++ b/sandbox_ui.lv2/sandbox_io.h
@@ -48,7 +48,7 @@ typedef struct _sandbox_io_shm_body_t sandbox_io_shm_body_t;
typedef struct _sandbox_io_shm_t sandbox_io_shm_t;
typedef struct _sandbox_io_t sandbox_io_t;
-typedef void (*_sandbox_io_recv_cb_t)(void *data, uint32_t index, uint32_t size,
+typedef bool (*_sandbox_io_recv_cb_t)(void *data, uint32_t index, uint32_t size,
uint32_t format, const void *buf);
typedef void (*_sandbox_io_subscribe_cb_t)(void *data, uint32_t index,
uint32_t protocol, bool state);
@@ -100,6 +100,7 @@ struct _sandbox_io_t {
char *name;
sandbox_io_shm_t *shm;
+ bool again;
};
static inline int
@@ -116,7 +117,12 @@ _sandbox_io_recv(sandbox_io_t *io, _sandbox_io_recv_cb_t recv_cb,
while((buf = varchunk_read_request(&rx->varchunk, &sz)))
{
- const LV2_Atom *atom = netatom_deserialize(io->netatom, (uint8_t *)buf, sz);
+ const LV2_Atom *atom = io->again
+ ? netatom_deserialize(io->netatom, (uint8_t *)buf, sz)
+ : (const LV2_Atom *)buf; // already deserialized in previous invocation
+
+ io->again = true;
+
if(atom)
{
if(!lv2_atom_forge_is_object_type(&io->forge, atom->type))
@@ -141,9 +147,9 @@ _sandbox_io_recv(sandbox_io_t *io, _sandbox_io_recv_cb_t recv_cb,
&& value && (value->atom.type == io->forge.Float)
&& (value->atom.size == sizeof(float)) )
{
- recv_cb(data, index->body,
- sizeof(float), io->float_protocol, &value->body);
- recv_cb(data, index->body,
+ io->again = recv_cb(data, index->body,
+ sizeof(float), io->float_protocol, &value->body)
+ && recv_cb(data, index->body,
sizeof(float), 0, &value->body);
}
}
@@ -177,7 +183,7 @@ _sandbox_io_recv(sandbox_io_t *io, _sandbox_io_recv_cb_t recv_cb,
.period_size = period_size->body,
.peak = peak->body
};
- recv_cb(data, index->body,
+ io->again = recv_cb(data, index->body,
sizeof(LV2UI_Peak_Data), io->peak_protocol, &peak_data);
}
}
@@ -198,7 +204,7 @@ _sandbox_io_recv(sandbox_io_t *io, _sandbox_io_recv_cb_t recv_cb,
&& (index->atom.size == sizeof(int32_t))
&& value)
{
- recv_cb(data, index->body,
+ io->again = recv_cb(data, index->body,
lv2_atom_total_size(value), obj->body.otype, value);
}
}
@@ -235,7 +241,10 @@ _sandbox_io_recv(sandbox_io_t *io, _sandbox_io_recv_cb_t recv_cb,
fprintf(stderr, "_sandbox_io_recv: netatom_deserialize failed\n");
}
- varchunk_read_advance(&rx->varchunk);
+ if(io->again)
+ varchunk_read_advance(&rx->varchunk);
+ else
+ break;
}
if(close_request)
diff --git a/sandbox_ui.lv2/sandbox_master.h b/sandbox_ui.lv2/sandbox_master.h
index 3593323..2fc2cd8 100644
--- a/sandbox_ui.lv2/sandbox_master.h
+++ b/sandbox_ui.lv2/sandbox_master.h
@@ -26,7 +26,7 @@ extern "C" {
typedef struct _sandbox_master_t sandbox_master_t;
typedef struct _sandbox_master_driver_t sandbox_master_driver_t;
-typedef void (*sandbox_master_recv_cb_t)(void *data, uint32_t index, uint32_t size,
+typedef bool (*sandbox_master_recv_cb_t)(void *data, uint32_t index, uint32_t size,
uint32_t format, const void *buf);
typedef void (*sandbox_master_subscribe_cb_t)(void *data, uint32_t index,
uint32_t protocol, bool state);
diff --git a/sandbox_ui.lv2/sandbox_slave.c b/sandbox_ui.lv2/sandbox_slave.c
index 63d0f70..734a1ab 100644
--- a/sandbox_ui.lv2/sandbox_slave.c
+++ b/sandbox_ui.lv2/sandbox_slave.c
@@ -160,7 +160,7 @@ _port_unsubscribe(LV2UI_Feature_Handle handle, uint32_t index, uint32_t protocol
return 0;
}
-static inline void
+static inline bool
_sandbox_recv_cb(LV2UI_Handle handle, uint32_t index, uint32_t size,
uint32_t protocol, const void *buf)
{
@@ -168,6 +168,8 @@ _sandbox_recv_cb(LV2UI_Handle handle, uint32_t index, uint32_t size,
if(sb->desc && sb->desc->port_event)
sb->desc->port_event(sb->handle, index, size, protocol, buf);
+
+ return true; // continue handling messages
}
static uint32_t