aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-05-18 17:11:40 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-05-18 17:11:40 +0200
commit74c942a036822959fdbfbc431d7075de813b6eaa (patch)
treed4b553be3940de3ac8e6997cdc8d89fa70287edf /plugins
parentf9e7bf7dee92b51805ac6c0e6b1e471c6866b4c8 (diff)
downloadsynthpod-74c942a036822959fdbfbc431d7075de813b6eaa.zip
synthpod-74c942a036822959fdbfbc431d7075de813b6eaa.tar.gz
synthpod-74c942a036822959fdbfbc431d7075de813b6eaa.tar.bz2
synthpod-74c942a036822959fdbfbc431d7075de813b6eaa.tar.xz
fixes for updated xpress.lv2.
* e.g. make voice uuid work across processes.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/synthpod_common_nk.c10
-rw-r--r--plugins/synthpod_lv2.c14
-rw-r--r--plugins/synthpod_lv2.h2
-rw-r--r--plugins/synthpod_stereo.c24
4 files changed, 30 insertions, 20 deletions
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index ca570f3..a7e0472 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -527,6 +527,8 @@ struct _plughandle_t {
#if defined(USE_CAIRO_CANVAS)
LV2_Canvas canvas;
#endif
+
+ xpress_t xpress;
};
static const char *bundle_search_labels [BUNDLE_SELECTOR_SEARCH_MAX] = {
@@ -7955,6 +7957,8 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
void *parent = NULL;
LV2UI_Resize *host_resize = NULL;
LV2_Options_Option *opts = NULL;
+ xpress_map_t *voice_map = NULL;
+
for(int i=0; features[i]; i++)
{
if(!strcmp(features[i]->URI, LV2_UI__parent))
@@ -7965,6 +7969,8 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
handle->map = features[i]->data;
else if(!strcmp(features[i]->URI, LV2_URID__unmap))
handle->unmap = features[i]->data;
+ else if(!strcmp(features[i]->URI, XPRESS__voiceMap))
+ voice_map = features[i]->data;
else if(!strcmp(features[i]->URI, LV2_OPTIONS__options))
opts = features[i]->data;
else if(!strcmp(features[i]->URI, LV2_LOG__log))
@@ -7993,6 +7999,9 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
return NULL;
}
+ xpress_init(&handle->xpress, 0, handle->map, voice_map,
+ XPRESS_EVENT_NONE, NULL, NULL, NULL); //FIXME use xpress_map()
+
if(handle->log)
lv2_log_logger_init(&handle->logger, handle->map, handle->log);
@@ -8169,6 +8178,7 @@ cleanup(LV2UI_Handle instance)
_hash_free(&handle->param_matches);
_hash_free(&handle->dynam_matches);
+ xpress_deinit(&handle->xpress);
_deinit(handle);
free(handle);
diff --git a/plugins/synthpod_lv2.c b/plugins/synthpod_lv2.c
index 8d00263..a1a8e7b 100644
--- a/plugins/synthpod_lv2.c
+++ b/plugins/synthpod_lv2.c
@@ -20,20 +20,6 @@
#include <synthpod_lv2.h>
-static atomic_long voice_uuid = ATOMIC_VAR_INIT(INT64_MAX / UINT16_MAX * 3LL);
-
-static xpress_uuid_t
-_voice_map_new_uuid(void *handle, uint32_t flag __attribute__((unused)))
-{
- atomic_long *uuid = handle;
- return atomic_fetch_add_explicit(uuid, 1, memory_order_relaxed);
-}
-
-xpress_map_t voice_map_fallback = {
- .handle = &voice_uuid,
- .new_uuid = _voice_map_new_uuid
-};
-
#ifdef _WIN32
__declspec(dllexport)
#else
diff --git a/plugins/synthpod_lv2.h b/plugins/synthpod_lv2.h
index 4f0b1e9..1052923 100644
--- a/plugins/synthpod_lv2.h
+++ b/plugins/synthpod_lv2.h
@@ -41,8 +41,6 @@
// bundle uri
#define SYNTHPOD_EVENT_URI SYNTHPOD_PREFIX"event"
-extern xpress_map_t voice_map_fallback;
-
// plugin uris
#define SYNTHPOD_KEYBOARD_URI SYNTHPOD_PREFIX"keyboard"
#define SYNTHPOD_CV2CONTROL_URI SYNTHPOD_PREFIX"cv2control"
diff --git a/plugins/synthpod_stereo.c b/plugins/synthpod_stereo.c
index b272b3a..94d3300 100644
--- a/plugins/synthpod_stereo.c
+++ b/plugins/synthpod_stereo.c
@@ -130,6 +130,9 @@ struct _plughandle_t {
varchunk_t *app_from_worker;
varchunk_t *app_from_ui;
varchunk_t *app_from_app;
+
+ xpress_t xpress;
+ xpress_map_t xmap;
};
static LV2_State_Status
@@ -342,6 +345,14 @@ _to_app_advance(size_t written, void *data)
varchunk_write_advance(handle->app_from_worker, written);
}
+__realtime static uint32_t
+_voice_map_new_uuid(void *data, uint32_t flags __attribute__((unused)))
+{
+ xpress_t *xpress = data;
+
+ return xpress_map(xpress);
+}
+
static LV2_Handle
instantiate(const LV2_Descriptor* descriptor, double rate,
const char *bundle_path, const LV2_Feature *const *features)
@@ -361,6 +372,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
handle->driver.bad_plugins = false; //FIXME
const LilvWorld *world = NULL;
+ xpress_map_t *voice_map = NULL;
for(int i=0; features[i]; i++)
{
@@ -369,7 +381,7 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
else if(!strcmp(features[i]->URI, LV2_URID__unmap))
handle->driver.unmap = (LV2_URID_Unmap *)features[i]->data;
else if(!strcmp(features[i]->URI, XPRESS__voiceMap))
- handle->driver.xmap = features[i]->data;
+ voice_map = features[i]->data;
else if(!strcmp(features[i]->URI, LV2_LOG__log))
handle->driver.log = (LV2_Log_Log *)features[i]->data;
else if(!strcmp(features[i]->URI, LV2_WORKER__schedule))
@@ -386,9 +398,6 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
handle->driver.features |= SP_APP_FEATURE_POWER_OF_2_BLOCK_LENGTH;
}
- if(!handle->driver.xmap)
- handle->driver.xmap = &voice_map_fallback;
-
if(!handle->driver.map)
{
fprintf(stderr,
@@ -415,6 +424,12 @@ instantiate(const LV2_Descriptor* descriptor, double rate,
return NULL;
}
+ xpress_init(&handle->xpress, 0, handle->driver.map, voice_map,
+ XPRESS_EVENT_NONE, NULL, NULL, NULL);
+ handle->xmap.new_uuid = _voice_map_new_uuid;
+ handle->xmap.handle = &handle->xpress;
+ handle->driver.xmap = &handle->xmap;
+
// map URIs
handle->uri.bufsz.max_block_length = handle->driver.map->map(handle->driver.map->handle,
LV2_BUF_SIZE__maxBlockLength);
@@ -928,6 +943,7 @@ cleanup(LV2_Handle instance)
varchunk_free(handle->app_from_worker);
varchunk_free(handle->app_from_ui);
varchunk_free(handle->app_from_app);
+ xpress_deinit(&handle->xpress);
munlock(handle, sizeof(plughandle_t));
free(handle);