aboutsummaryrefslogtreecommitdiff
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
parent80424d14b72e7a3fe1f6474bd501735cdf384163 (diff)
downloadsynthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.zip
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.gz
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.bz2
synthpod-fc6b75af8b0b88f7fdf33e9c28e9eb8014ea583c.tar.xz
fix draining broken in last commit.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app_worker.c2
-rw-r--r--bin/synthpod_bin.c8
-rw-r--r--plugins/synthpod_common_nk.c4
-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
7 files changed, 30 insertions, 17 deletions
diff --git a/VERSION b/VERSION
index 04e39df..b97b2a9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5169
+0.1.5171
diff --git a/app/synthpod_app_worker.c b/app/synthpod_app_worker.c
index 89095ed..dc855dd 100644
--- a/app/synthpod_app_worker.c
+++ b/app/synthpod_app_worker.c
@@ -265,8 +265,6 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
{
const job_t *job = ASSUME_ALIGNED(data);
- printf("got job: %u\n", job->request);
-
switch(job->request)
{
case JOB_TYPE_REQUEST_MODULE_SUPPORTED:
diff --git a/bin/synthpod_bin.c b/bin/synthpod_bin.c
index 64b2421..81b2279 100644
--- a/bin/synthpod_bin.c
+++ b/bin/synthpod_bin.c
@@ -201,7 +201,7 @@ _log_printf(void *data, LV2_URID type, const char *fmt, ...)
return ret;
}
-__non_realtime static void
+__realtime static bool
_sb_recv_cb(void *data, uint32_t index, uint32_t size, uint32_t format,
const void *buf)
{
@@ -215,12 +215,14 @@ _sb_recv_cb(void *data, uint32_t index, uint32_t size, uint32_t format,
if(!bin->advance_ui)
{
//fprintf(stderr, "ui is blocked\n");
- return; //FIXME take into account bin->advance_ui
+ return false; // pause handling messages from UI (until fully drained)
}
}
+
+ return true; // continue handling messages from UI
}
-__non_realtime static void
+__realtime static void
_sb_subscribe_cb(void *data, uint32_t index, uint32_t protocol, bool state)
{
bin_t *bin = data;
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 2c6e3f4..953ee73 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -2013,7 +2013,7 @@ _mod_nk_write_function(plughandle_t *handle, mod_t *src_mod, port_t *src_port,
nk_pugl_post_redisplay(&handle->win);
}
-static void
+static bool
_mod_ui_write_function(LV2UI_Controller controller, uint32_t index,
uint32_t size, uint32_t protocol, const void *buffer)
{
@@ -2057,6 +2057,8 @@ _mod_ui_write_function(LV2UI_Controller controller, uint32_t index,
// FIXME routing to nk not needed, will be fed back via dsp
}
}
+
+ return true; // continue handling messages
}
static void
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