aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-09-12 15:59:31 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-09-12 15:59:31 +0200
commite2469c00d7b7370678beb328a37ab069173c764d (patch)
tree695755823cc5e53a642a5e720d1b2c8e7d8d1bd7
parentb4753d158c5741847d44780d7fd777f01456da3d (diff)
downloadsynthpod-e2469c00d7b7370678beb328a37ab069173c764d.zip
synthpod-e2469c00d7b7370678beb328a37ab069173c764d.tar.gz
synthpod-e2469c00d7b7370678beb328a37ab069173c764d.tar.bz2
synthpod-e2469c00d7b7370678beb328a37ab069173c764d.tar.xz
nk: give UI IPC 1s before subscribing to ports.
-rw-r--r--VERSION2
-rw-r--r--plugins/synthpod_common_nk.c30
-rw-r--r--sandbox_ui.lv2/sandbox_master.c6
-rw-r--r--sandbox_ui.lv2/sandbox_master.h3
4 files changed, 35 insertions, 6 deletions
diff --git a/VERSION b/VERSION
index beb642e..0225fd5 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.6129
+0.1.6131
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 5714fe3..aee9893 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -3017,11 +3017,6 @@ _mod_ui_run(mod_ui_t *mod_ui, bool sync)
&& mod_ui->sbox.socket_uri && mod_ui->sbox.window_name && mod_ui->sbox.minimum
&& mod_ui->sbox.sample_rate && mod_ui->sbox.update_rate && mod_ui->sbox.sb)
{
- _mod_subscribe_all(handle, mod);
-
- _patch_notification_add_patch_get(handle, mod,
- handle->regs.port.event_transfer.urid, mod->subj, 0, 0); // patch:Get []
-
const pid_t pid = vfork();
if(pid == 0) // child
{
@@ -3064,6 +3059,31 @@ _mod_ui_run(mod_ui_t *mod_ui, bool sync)
// parent
mod_ui->pid = pid;
+ bool connected = false;
+
+ for(unsigned i = 0; i < 10; i++)
+ {
+ if(sandbox_master_connected_get(mod_ui->sbox.sb))
+ {
+ connected = true;
+ break;
+ }
+
+ // wait for connection
+ _log_note(handle, "waiting for UI IPC\n");
+ usleep(100000);
+ }
+
+ if(!connected)
+ {
+ _log_error(handle, "UI IPC was not up after 1s\n");
+ }
+
+ _mod_subscribe_all(handle, mod);
+
+ _patch_notification_add_patch_get(handle, mod,
+ handle->regs.port.event_transfer.urid, mod->subj, 0, 0); // patch:Get []
+
if(sync)
{
if( _message_request(handle)
diff --git a/sandbox_ui.lv2/sandbox_master.c b/sandbox_ui.lv2/sandbox_master.c
index 16010bf..bd8ef06 100644
--- a/sandbox_ui.lv2/sandbox_master.c
+++ b/sandbox_ui.lv2/sandbox_master.c
@@ -106,3 +106,9 @@ sandbox_master_signal_tx(sandbox_master_t *sb)
{
_sandbox_io_signal_tx(&sb->io);
}
+
+bool
+sandbox_master_connected_get(sandbox_master_t *sb)
+{
+ return _sandbox_io_connected_get(&sb->io);
+}
diff --git a/sandbox_ui.lv2/sandbox_master.h b/sandbox_ui.lv2/sandbox_master.h
index 0246116..8c3bc91 100644
--- a/sandbox_ui.lv2/sandbox_master.h
+++ b/sandbox_ui.lv2/sandbox_master.h
@@ -64,6 +64,9 @@ sandbox_master_signal_rx(sandbox_master_t *sb);
void
sandbox_master_signal_tx(sandbox_master_t *sb);
+bool
+sandbox_master_connected_get(sandbox_master_t *sb);
+
#ifdef __cplusplus
}
#endif