aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app.c4
-rw-r--r--app/synthpod_app_mod.c14
-rw-r--r--app/synthpod_app_private.h4
-rw-r--r--app/synthpod_app_state.c6
-rw-r--r--app/synthpod_app_ui.c17
-rw-r--r--app/synthpod_app_worker.c19
-rw-r--r--bin/synthpod_jack.c34
-rw-r--r--include/synthpod_app.h3
9 files changed, 94 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index e527e3ea..e81272c1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.6145
+0.1.6147
diff --git a/app/synthpod_app.c b/app/synthpod_app.c
index 49c899dd..3c22807a 100644
--- a/app/synthpod_app.c
+++ b/app/synthpod_app.c
@@ -771,7 +771,7 @@ _sp_app_populate(sp_app_t *app)
// inject source mod
uri_str = SYNTHPOD_PREFIX"source";
- mod = _sp_app_mod_add(app, uri_str, 0, 0);
+ mod = _sp_app_mod_add(app, uri_str, 0, 0, NULL);
if(mod)
{
app->mods[app->num_mods] = mod;
@@ -784,7 +784,7 @@ _sp_app_populate(sp_app_t *app)
// inject sink mod
uri_str = SYNTHPOD_PREFIX"sink";
- mod = _sp_app_mod_add(app, uri_str, 0, 0);
+ mod = _sp_app_mod_add(app, uri_str, 0, 0, NULL);
if(mod)
{
app->mods[app->num_mods] = mod;
diff --git a/app/synthpod_app_mod.c b/app/synthpod_app_mod.c
index e666e602..e8b69e18 100644
--- a/app/synthpod_app_mod.c
+++ b/app/synthpod_app_mod.c
@@ -587,7 +587,8 @@ _mod_queue_draw(void *data)
}
mod_t *
-_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created)
+_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created,
+ const char *alias)
{
const LilvPlugin *plug;
@@ -611,6 +612,11 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created)
mod->created = created;
+ if(alias != NULL)
+ {
+ strncpy(mod->alias, alias, ALIAS_MAX - 1);
+ }
+
mod->needs_bypassing = false; // plugins with control ports only need no bypassing upon preset load
mod->bypassed = false;
atomic_init(&mod->dsp_client.ref_count, 0);
@@ -807,6 +813,12 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created)
free(short_name);
free(pretty_name);
}
+
+ if(strlen(mod->alias) && app->driver->system_port_set)
+ {
+ app->driver->system_port_set(app->data, tar->sys.data,
+ SYNTHPOD_PREFIX"#moduleAlias", mod->alias);
+ }
}
else
{
diff --git a/app/synthpod_app_private.h b/app/synthpod_app_private.h
index 315151e8..3177ad7a 100644
--- a/app/synthpod_app_private.h
+++ b/app/synthpod_app_private.h
@@ -121,6 +121,7 @@ enum _job_type_request_t {
JOB_TYPE_REQUEST_MODULE_ADD,
JOB_TYPE_REQUEST_MODULE_DEL,
JOB_TYPE_REQUEST_MODULE_REINSTANTIATE,
+ JOB_TYPE_REQUEST_MODULE_SYSTEM_PORTS_UPDATE,
JOB_TYPE_REQUEST_PRESET_LOAD,
JOB_TYPE_REQUEST_PRESET_SAVE,
JOB_TYPE_REQUEST_BUNDLE_LOAD,
@@ -675,7 +676,8 @@ _sp_app_state_bundle_load(sp_app_t *app, const char *bundle_path);
* Mod
*/
mod_t *
-_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created);
+_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created,
+ const char *alias);
void
_sp_app_mod_eject(sp_app_t *app, mod_t *mod);
diff --git a/app/synthpod_app_state.c b/app/synthpod_app_state.c
index 3007c41c..f4e27eda 100644
--- a/app/synthpod_app_state.c
+++ b/app/synthpod_app_state.c
@@ -1403,9 +1403,11 @@ _mod_inject(sp_app_t *app, int32_t mod_uid, LV2_URID mod_urn, const LV2_Atom_Obj
const uint32_t created = mod_created && (mod_created->atom.type == app->forge.Int)
? mod_created->body : 0;
+ const char *alias = mod_alias && (mod_alias->atom.type == app->forge.String)
+ ? (const char *)LV2_ATOM_BODY_CONST(mod_alias) : NULL;
const char *mod_uri_str = app->driver->unmap->unmap(app->driver->unmap->handle, mod_obj->body.otype);
- mod_t *mod = _sp_app_mod_add(app, mod_uri_str, mod_urn, created);
+ mod_t *mod = _sp_app_mod_add(app, mod_uri_str, mod_urn, created, alias);
if(!mod)
{
sp_app_log_error(app, "%s: _sp_app_mod_add fialed\n", __func__);
@@ -1424,8 +1426,6 @@ _mod_inject(sp_app_t *app, int32_t mod_uid, LV2_URID mod_urn, const LV2_Atom_Obj
? mod_visible->body : 0;
mod->disabled = mod_disabled && (mod_disabled->atom.type == app->forge.Bool)
? mod_disabled->body : false;
- if(mod_alias)
- strncpy(mod->alias, LV2_ATOM_BODY_CONST(&mod_alias->atom), ALIAS_MAX - 1);
mod->ui = mod_ui && (mod_ui->atom.type == app->forge.URID)
? mod_ui->body : 0;
diff --git a/app/synthpod_app_ui.c b/app/synthpod_app_ui.c
index ccd11121..45663c8e 100644
--- a/app/synthpod_app_ui.c
+++ b/app/synthpod_app_ui.c
@@ -865,6 +865,23 @@ _sp_app_from_ui_patch_set(sp_app_t *app, const LV2_Atom *atom)
&& (value->type == app->forge.String) )
{
strncpy(mod->alias, LV2_ATOM_BODY_CONST(value), ALIAS_MAX - 1);
+
+ if(mod->system_ports)
+ {
+ // send request to worker thread
+ size_t size = sizeof(job_t);
+ job_t *job = _sp_app_to_worker_request(app, size);
+ if(job)
+ {
+ job->request = JOB_TYPE_REQUEST_MODULE_SYSTEM_PORTS_UPDATE;
+ job->mod = mod;
+ _sp_app_to_worker_advance(app, size);
+ }
+ else
+ {
+ sp_app_log_trace(app, "%s: buffer request failed\n", __func__);
+ }
+ }
}
else if( (prop == app->regs.ui.ui.urid)
&& (value->type == app->forge.URID) )
diff --git a/app/synthpod_app_worker.c b/app/synthpod_app_worker.c
index e249bc69..fef1ba06 100644
--- a/app/synthpod_app_worker.c
+++ b/app/synthpod_app_worker.c
@@ -351,7 +351,7 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
case JOB_TYPE_REQUEST_MODULE_ADD:
{
const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
- mod_t *mod = uri ? _sp_app_mod_add(app, uri, 0, 0) : NULL;
+ mod_t *mod = uri ? _sp_app_mod_add(app, uri, 0, 0, NULL) : NULL;
if(!mod)
break; //TODO report
@@ -413,6 +413,23 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
break;
}
+ case JOB_TYPE_REQUEST_MODULE_SYSTEM_PORTS_UPDATE:
+ {
+ mod_t *mod = job->mod;
+
+ if(mod->system_ports && strlen(mod->alias) && app->driver->system_port_set)
+ {
+ for(unsigned i=0; i<mod->num_ports - 2; i++) // - automation ports
+ {
+ port_t *tar = &mod->ports[i];
+
+ app->driver->system_port_set(app->data, tar->sys.data,
+ SYNTHPOD_PREFIX"#moduleAlias", mod->alias);
+ }
+ }
+
+ break;
+ }
case JOB_TYPE_REQUEST_PRESET_LOAD:
{
const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
diff --git a/bin/synthpod_jack.c b/bin/synthpod_jack.c
index 57ed6aa3..b65e6f73 100644
--- a/bin/synthpod_jack.c
+++ b/bin/synthpod_jack.c
@@ -721,6 +721,39 @@ _system_port_del(void *data, void *sys_port)
}
__non_realtime static void
+_system_port_set(void *data, void *sys_port, const char *key, const void *body)
+{
+ bin_t *bin = data;
+ sp_app_t *app = bin->app;
+ prog_t *handle = (void *)bin - offsetof(prog_t, bin);
+
+ jack_port_t *jack_port = sys_port;
+
+ if(!jack_port || !handle->client)
+ return;
+
+ if(!strcmp(key, SYNTHPOD_PREFIX"#moduleAlias"))
+ {
+#if defined(JACK_HAS_METADATA_API)
+ jack_uuid_t uuid = jack_port_uuid(jack_port);
+ if(!jack_uuid_empty(uuid))
+ {
+ char pretty_name [128];
+ const char *alias = body;
+
+ const char *port_name = jack_port_name(jack_port);
+ uint32_t idx = port_name[strlen(port_name) - 1] - '0';
+
+ snprintf(pretty_name, sizeof(pretty_name), "%s - %"PRIu32, alias, idx);
+
+ jack_set_property(handle->client, uuid,
+ JACK_METADATA_PRETTY_NAME, pretty_name, "text/plain");
+ }
+#endif
+ }
+}
+
+__non_realtime static void
_shutdown(void *data)
{
prog_t *handle = data;
@@ -1150,6 +1183,7 @@ main(int argc, char **argv)
bin->app_driver.system_port_add = _system_port_add;
bin->app_driver.system_port_del = _system_port_del;
+ bin->app_driver.system_port_set = _system_port_set;
handle.osc_sched.osc2frames = _osc_schedule_osc2frames;
handle.osc_sched.frames2osc = _osc_schedule_frames2osc;
diff --git a/include/synthpod_app.h b/include/synthpod_app.h
index 5fbe539b..aa37b900 100644
--- a/include/synthpod_app.h
+++ b/include/synthpod_app.h
@@ -48,6 +48,8 @@ typedef void *(*sp_system_port_add)(void *data, system_port_t type,
const char *short_name, const char *pretty_name, const char *designation,
bool input, uint32_t order);
typedef void (*sp_system_port_del)(void *data, void *sys_port);
+typedef void (*sp_system_port_set)(void *data, void *sys_port, const char *key,
+ const void *body);
typedef void (*sp_close_request_t)(void *data);
@@ -110,6 +112,7 @@ struct _sp_app_driver_t {
// system_port
sp_system_port_add system_port_add;
sp_system_port_del system_port_del;
+ sp_system_port_set system_port_set;
// clock_sync
LV2_OSC_Schedule *osc_sched;