aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2020-03-25 10:45:45 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2020-03-25 10:45:45 +0100
commit0de7d14130fc243f8849c8747babf95e79619110 (patch)
treee04530c5af0db413f5390dd147d17ec409754727
parent9d5f007a65dfbdb45d95a745476a55be215f051b (diff)
downloadsynthpod-0de7d14130fc243f8849c8747babf95e79619110.tar.xz
jack: order ports according to plugin create time.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app.c4
-rw-r--r--app/synthpod_app_mod.c11
-rw-r--r--app/synthpod_app_private.h4
-rw-r--r--app/synthpod_app_state.c24
-rw-r--r--app/synthpod_app_worker.c2
-rw-r--r--include/synthpod_private.h3
7 files changed, 41 insertions, 9 deletions
diff --git a/VERSION b/VERSION
index db2f97f1..e527e3ea 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.6143
+0.1.6145
diff --git a/app/synthpod_app.c b/app/synthpod_app.c
index edcc73b5..49c899dd 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);
+ mod = _sp_app_mod_add(app, uri_str, 0, 0);
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);
+ mod = _sp_app_mod_add(app, uri_str, 0, 0);
if(mod)
{
app->mods[app->num_mods] = mod;
diff --git a/app/synthpod_app_mod.c b/app/synthpod_app_mod.c
index 6e44e0db..e666e602 100644
--- a/app/synthpod_app_mod.c
+++ b/app/synthpod_app_mod.c
@@ -587,7 +587,7 @@ _mod_queue_draw(void *data)
}
mod_t *
-_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn)
+_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created)
{
const LilvPlugin *plug;
@@ -597,6 +597,11 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn)
return NULL;
}
+ if(created == 0)
+ {
+ created = ++app->created;
+ }
+
mod_t *mod = calloc(1, sizeof(mod_t));
if(!mod)
{
@@ -604,6 +609,8 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn)
return NULL;
}
+ mod->created = created;
+
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);
@@ -789,7 +796,7 @@ _sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn)
asprintf(&pretty_name, "#%"PRIu32" - %s",
mod->urn, lilv_node_as_string(port_name_node));
designation = port_designation ? lilv_node_as_string(port_designation) : NULL;
- const uint32_t order = (mod->urn << 16) | tar->index;
+ const uint32_t order = (mod->created << 16) | tar->index;
tar->sys.data = app->driver->system_port_add(app->data, tar->sys.type,
short_name, pretty_name, designation,
diff --git a/app/synthpod_app_private.h b/app/synthpod_app_private.h
index 91901e1c..315151e8 100644
--- a/app/synthpod_app_private.h
+++ b/app/synthpod_app_private.h
@@ -263,6 +263,7 @@ struct _mod_t {
LV2_URID urn;
LV2_URID visible;
bool disabled;
+ uint32_t created;
bool delete_request;
bool needs_bypassing;
@@ -513,6 +514,7 @@ struct _sp_app_t {
int32_t column_enabled;
int32_t row_enabled;
+ uint32_t created;
};
extern const port_driver_t control_port_driver;
@@ -673,7 +675,7 @@ _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);
+_sp_app_mod_add(sp_app_t *app, const char *uri, LV2_URID urn, uint32_t created);
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 bd3f8682..3007c41c 100644
--- a/app/synthpod_app_state.c
+++ b/app/synthpod_app_state.c
@@ -1012,6 +1012,12 @@ sp_app_save(sp_app_t *app, LV2_State_Store_Function store,
}
if(ref)
+ {
+ ref = lv2_atom_forge_key(forge, app->regs.synthpod.module_created.urid)
+ && lv2_atom_forge_int(forge, mod->created);
+ }
+
+ if(ref)
lv2_atom_forge_pop(forge, &mod_frame);
}
else
@@ -1384,6 +1390,7 @@ _mod_inject(sp_app_t *app, int32_t mod_uid, LV2_URID mod_urn, const LV2_Atom_Obj
const LV2_Atom_URID *mod_ui = NULL;
const LV2_Atom_Bool *mod_visible = NULL;
const LV2_Atom_Bool *mod_disabled = NULL;
+ const LV2_Atom_Int *mod_created = NULL;
lv2_atom_object_get(mod_obj,
app->regs.synthpod.module_position_x.urid, &mod_pos_x,
app->regs.synthpod.module_position_y.urid, &mod_pos_y,
@@ -1391,10 +1398,14 @@ _mod_inject(sp_app_t *app, int32_t mod_uid, LV2_URID mod_urn, const LV2_Atom_Obj
app->regs.ui.ui.urid, &mod_ui,
app->regs.synthpod.module_visible.urid, &mod_visible,
app->regs.synthpod.module_disabled.urid, &mod_disabled,
+ app->regs.synthpod.module_created.urid, &mod_created,
0);
+ const uint32_t created = mod_created && (mod_created->atom.type == app->forge.Int)
+ ? mod_created->body : 0;
+
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);
+ mod_t *mod = _sp_app_mod_add(app, mod_uri_str, mod_urn, created);
if(!mod)
{
sp_app_log_error(app, "%s: _sp_app_mod_add fialed\n", __func__);
@@ -1526,6 +1537,9 @@ sp_app_restore(sp_app_t *app, LV2_State_Retrieve_Function retrieve,
return LV2_STATE_ERR_UNKNOWN;
}
+ // reset created counter
+ app->created = 0;
+
size_t size;
uint32_t _flags;
uint32_t type;
@@ -1574,11 +1588,17 @@ sp_app_restore(sp_app_t *app, LV2_State_Retrieve_Function retrieve,
{
mod_obj->body.otype = app->regs.synthpod.placeholder.urid;
mod = _mod_inject(app, mod_index, mod_urn, mod_obj, map_path);
- if(mod)
+ if(!mod)
{
snprintf(mod->alias, sizeof(mod->alias), "%s", "!!! Failed to load !!!");
+ continue;
}
}
+
+ if(mod->created > app->created)
+ {
+ app->created = mod->created;
+ }
}
_sp_app_order(app);
diff --git a/app/synthpod_app_worker.c b/app/synthpod_app_worker.c
index 3656d492..e249bc69 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) : NULL;
+ mod_t *mod = uri ? _sp_app_mod_add(app, uri, 0, 0) : NULL;
if(!mod)
break; //TODO report
diff --git a/include/synthpod_private.h b/include/synthpod_private.h
index 50fbd4af..f7d4cc28 100644
--- a/include/synthpod_private.h
+++ b/include/synthpod_private.h
@@ -362,6 +362,7 @@ struct _reg_t {
reg_item_t module_position_y;
reg_item_t module_alias;
reg_item_t module_reinstantiate;
+ reg_item_t module_created;
reg_item_t node_position_x;
reg_item_t node_position_y;
reg_item_t graph_position_x;
@@ -657,6 +658,7 @@ sp_regs_init(reg_t *regs, LilvWorld *world, LV2_URID_Map *map)
_register(&regs->synthpod.module_position_y, world, map, SYNTHPOD_PREFIX"modulePositionY");
_register(&regs->synthpod.module_alias, world, map, SYNTHPOD_PREFIX"moduleAlias");
_register(&regs->synthpod.module_reinstantiate, world, map, SYNTHPOD_PREFIX"moduleReinstantiate");
+ _register(&regs->synthpod.module_created, world, map, SYNTHPOD_PREFIX"moduleCreated");
_register(&regs->synthpod.node_position_x, world, map, SYNTHPOD_PREFIX"nodePositionX");
_register(&regs->synthpod.node_position_y, world, map, SYNTHPOD_PREFIX"nodePositionY");
_register(&regs->synthpod.graph_position_x, world, map, SYNTHPOD_PREFIX"graphPositionX");
@@ -917,6 +919,7 @@ sp_regs_deinit(reg_t *regs)
_unregister(&regs->synthpod.module_position_y);
_unregister(&regs->synthpod.module_alias);
_unregister(&regs->synthpod.module_reinstantiate);
+ _unregister(&regs->synthpod.module_created);
_unregister(&regs->synthpod.node_position_x);
_unregister(&regs->synthpod.node_position_y);
_unregister(&regs->synthpod.graph_position_x);