aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-27 21:46:27 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-27 21:46:27 +0200
commitc3be1c92d4975595936da00fddbca0d9e26f4453 (patch)
tree30787b34f5ef6eceda22aae9dfde9866b52df5cb
parent20e0d4a6037ddbc51ed7e396caa669cfbe75c691 (diff)
downloadsynthpod-c3be1c92d4975595936da00fddbca0d9e26f4453.tar.xz
api: replace worker->uri with worker->urn.
-rw-r--r--VERSION2
-rw-r--r--app/synthpod_app_private.h3
-rw-r--r--app/synthpod_app_ui.c33
-rw-r--r--app/synthpod_app_worker.c60
4 files changed, 45 insertions, 53 deletions
diff --git a/VERSION b/VERSION
index d9005188..7a269904 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.4985
+0.1.4987
diff --git a/app/synthpod_app_private.h b/app/synthpod_app_private.h
index 36bb20c9..d2cdc2fc 100644
--- a/app/synthpod_app_private.h
+++ b/app/synthpod_app_private.h
@@ -167,9 +167,8 @@ struct _job_t {
union {
mod_t *mod;
int32_t status;
- LV2_URID urn;
};
- char uri [0];
+ LV2_URID urn;
};
struct _pool_t {
diff --git a/app/synthpod_app_ui.c b/app/synthpod_app_ui.c
index b650ba36..fd4237b6 100644
--- a/app/synthpod_app_ui.c
+++ b/app/synthpod_app_ui.c
@@ -1387,9 +1387,8 @@ _sp_app_from_ui_patch_set(sp_app_t *app, const LV2_Atom *atom)
return false; // not fully silenced yet, wait
// send request to worker thread
- const LV2_URID pset_urid = ((const LV2_Atom_URID *)value)->body;
- const char *pset_uri = app->driver->unmap->unmap(app->driver->unmap->handle, pset_urid);
- size_t size = sizeof(job_t) + strlen(pset_uri) + 1;
+ const LV2_URID pset_urn = ((const LV2_Atom_URID *)value)->body;
+ size_t size = sizeof(job_t);
job_t *job = _sp_app_to_worker_request(app, size);
if(job)
{
@@ -1398,7 +1397,7 @@ _sp_app_from_ui_patch_set(sp_app_t *app, const LV2_Atom *atom)
job->request = JOB_TYPE_REQUEST_PRESET_LOAD;
job->mod = mod;
- memcpy(job->uri, pset_uri, strlen(pset_uri) + 1);
+ job->urn = pset_urn;
_sp_app_to_worker_advance(app, size);
return true; // advance
@@ -1437,8 +1436,6 @@ _sp_app_from_ui_patch_copy(sp_app_t *app, const LV2_Atom *atom)
if(!subj && dest) // save bundle to dest
{
- const char *path_str = app->driver->unmap->unmap(app->driver->unmap->handle, dest); //FIXME use urn directly
-
if(app->block_state == BLOCKING_STATE_RUN)
{
// send request to worker thread
@@ -1456,15 +1453,15 @@ _sp_app_from_ui_patch_copy(sp_app_t *app, const LV2_Atom *atom)
else if(app->block_state == BLOCKING_STATE_BLOCK)
{
// send request to worker thread
- size_t size = sizeof(job_t) + strlen(path_str) + 1;
+ size_t size = sizeof(job_t);
job_t *job = _sp_app_to_worker_request(app, size);
if(job)
{
app->block_state = BLOCKING_STATE_WAIT; // wait for job
job->request = JOB_TYPE_REQUEST_BUNDLE_SAVE;
- job->status = -1; //FIXME what is this for again?
- memcpy(job->uri, path_str, strlen(path_str) + 1);
+ job->status = -1; // TODO for what for?
+ job->urn = dest;
_sp_app_to_worker_advance(app, size);
return true; // advance
@@ -1473,8 +1470,6 @@ _sp_app_from_ui_patch_copy(sp_app_t *app, const LV2_Atom *atom)
}
else if(subj && !dest) // copy bundle from subj
{
- const char *path_str = app->driver->unmap->unmap(app->driver->unmap->handle, subj); //FIXME use urn directly
-
if(app->block_state == BLOCKING_STATE_RUN)
{
//FIXME ramp down system outputs
@@ -1496,17 +1491,16 @@ _sp_app_from_ui_patch_copy(sp_app_t *app, const LV2_Atom *atom)
//FIXME ramp up system outputs
// send request to worker thread
- size_t size = sizeof(job_t) + strlen(path_str) + 1;
- job_t *job = _sp_app_to_worker_request(app, size);
+ job_t *job = _sp_app_to_worker_request(app, sizeof(job_t));
if(job)
{
app->block_state = BLOCKING_STATE_WAIT; // wait for job
app->load_bundle = true; // for sp_app_bypassed
job->request = JOB_TYPE_REQUEST_BUNDLE_LOAD;
- job->status = -1; //FIXME what is this for again?
- memcpy(job->uri, path_str, strlen(path_str) + 1);
- _sp_app_to_worker_advance(app, size);
+ job->status = -1; // TODO for what for?
+ job->urn = subj;
+ _sp_app_to_worker_advance(app, sizeof(job_t));
return true; // advance
}
@@ -1945,17 +1939,16 @@ _automation_list_add(sp_app_t *app, const LV2_Atom_Object *obj)
__realtime static void
_mod_list_add(sp_app_t *app, const LV2_Atom_URID *urid)
{
- const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, urid->body);
//printf("got patch:add for moduleList: %s\n", uri);
// send request to worker thread
- const size_t uri_sz = strlen(uri) + 1;
- const size_t size = sizeof(job_t) + uri_sz;
+ const size_t size = sizeof(job_t);
job_t *job = _sp_app_to_worker_request(app, size);
if(job)
{
job->request = JOB_TYPE_REQUEST_MODULE_ADD;
- memcpy(job->uri, uri, uri_sz);
+ job->status = 0;
+ job->urn = urid->body;
_sp_app_to_worker_advance(app, size);
}
}
diff --git a/app/synthpod_app_worker.c b/app/synthpod_app_worker.c
index e2b11451..095a88b7 100644
--- a/app/synthpod_app_worker.c
+++ b/app/synthpod_app_worker.c
@@ -250,6 +250,7 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
{
case JOB_TYPE_REQUEST_MODULE_SUPPORTED:
{
+#if 0
const int32_t status= _sp_app_mod_is_supported(app, job->uri) ? 1 : 0;
// signal to app
@@ -262,22 +263,23 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
memcpy(job1->uri, job->uri, strlen(job->uri) + 1);
_sp_worker_to_app_advance(app, job_size);
}
+#endif
break;
}
case JOB_TYPE_REQUEST_MODULE_ADD:
{
- mod_t *mod = _sp_app_mod_add(app, job->uri, 0);
+ 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;
if(!mod)
break; //TODO report
// signal to app
- size_t job_size = sizeof(job_t);
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_MODULE_ADD;
job1->mod = mod;
- _sp_worker_to_app_advance(app, job_size);
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
@@ -288,83 +290,82 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
int status = _sp_app_mod_del(app, job->mod);
// signal to app
- size_t job_size = sizeof(job_t);
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_MODULE_DEL;
job1->urn = urn;
- _sp_worker_to_app_advance(app, job_size);
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
}
case JOB_TYPE_REQUEST_PRESET_LOAD:
{
- int status = _sp_app_state_preset_load(app, job->mod, job->uri, true);
+ const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
+ int status = _sp_app_state_preset_load(app, job->mod, uri, true);
(void)status; //FIXME check this
// signal to app
- size_t job_size = sizeof(job_t);
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_PRESET_LOAD;
job1->mod = job->mod;
- _sp_worker_to_app_advance(app, job_size);
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
}
case JOB_TYPE_REQUEST_PRESET_SAVE:
{
- int status = _sp_app_state_preset_save(app, job->mod, job->uri);
+ const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
+ int status = _sp_app_state_preset_save(app, job->mod, uri);
(void)status; //FIXME check this
// signal to app
- size_t job_size = sizeof(job_t);
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_PRESET_SAVE;
job1->mod = job->mod;
- _sp_worker_to_app_advance(app, job_size);
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
}
case JOB_TYPE_REQUEST_BUNDLE_LOAD:
{
- int status = _sp_app_state_bundle_load(app, job->uri);
- printf("loaded from: %s\n", job->uri);
+ const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
+ int status = _sp_app_state_bundle_load(app, uri);
+ printf("loaded from: %s\n", uri);
// signal to app
- size_t job_size = sizeof(job_t) + strlen(job->uri) + 1;
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_BUNDLE_LOAD;
job1->status = status;
- strcpy(job1->uri, job->uri);
- _sp_worker_to_app_advance(app, job_size);
+ job1->urn = job->urn;
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
}
case JOB_TYPE_REQUEST_BUNDLE_SAVE:
{
- int status = _sp_app_state_bundle_save(app, job->uri);
- printf("saved to: %s\n", job->uri);
+ const char *uri = app->driver->unmap->unmap(app->driver->unmap->handle, job->urn);
+ int status = _sp_app_state_bundle_save(app, uri);
+ printf("saved to: %s\n", uri);
// signal to app
- size_t job_size = sizeof(job_t) + strlen(job->uri) + 1;
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_BUNDLE_SAVE;
job1->status = status;
- strcpy(job1->uri, job->uri);
- _sp_worker_to_app_advance(app, job_size);
+ job1->urn = job->urn;
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;
@@ -372,13 +373,12 @@ sp_worker_from_app(sp_app_t *app, uint32_t len, const void *data)
case JOB_TYPE_REQUEST_DRAIN:
{
// signal to app
- size_t job_size = sizeof(job_t);
- job_t *job1 = _sp_worker_to_app_request(app, job_size);
+ job_t *job1 = _sp_worker_to_app_request(app, sizeof(job_t));
if(job1)
{
job1->reply = JOB_TYPE_REPLY_DRAIN;
job1->status = 0;
- _sp_worker_to_app_advance(app, job_size);
+ _sp_worker_to_app_advance(app, sizeof(job_t));
}
break;