aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-04-13 16:32:28 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2018-04-13 16:32:28 +0200
commitfb8200c91acfcf77463e7ecf5a782da528e804fb (patch)
tree6d23a9fee01f3e68849d7152ecd2d3dc92d36570 /plugins
parentb87e4573fcef201c4ef60fc039821f22f7fe85b1 (diff)
downloadsynthpod-fb8200c91acfcf77463e7ecf5a782da528e804fb.zip
synthpod-fb8200c91acfcf77463e7ecf5a782da528e804fb.tar.gz
synthpod-fb8200c91acfcf77463e7ecf5a782da528e804fb.tar.bz2
synthpod-fb8200c91acfcf77463e7ecf5a782da528e804fb.tar.xz
nk: preparations for canvas.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/meson.build2
-rw-r--r--plugins/synthpod_common_nk.c33
2 files changed, 33 insertions, 2 deletions
diff --git a/plugins/meson.build b/plugins/meson.build
index 28b72fd..60a0634 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -8,7 +8,7 @@ dsp_srcs = ['synthpod_lv2.c',
'synthpod_placeholder.c',
'synthpod_stereo.c']
-ui_deps = [m_dep, rt_dep, thread_dep, lv2_dep, lilv_dep]
+ui_deps = [m_dep, rt_dep, thread_dep, lv2_dep, lilv_dep, cairo_dep]
ui_srcs = ['synthpod_lv2_nk.c',
'synthpod_keyboard_nk.c',
'synthpod_common_nk.c']
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 3410ee2..b1e3296 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -46,6 +46,12 @@
#include <lilv/lilv.h>
+#if defined(USE_CAIRO_CANVAS)
+# include <canvas.lv2/canvas.h>
+# include <canvas.lv2/forge.h>
+# include <canvas.lv2/render.h>
+#endif
+
#define SEARCH_BUF_MAX 128
#define ATOM_BUF_MAX 0x100000 // 1M
#define CONTROL 14 //FIXME
@@ -296,6 +302,13 @@ struct _mod_t {
struct nk_image img;
} idisp;
char alias [ALIAS_MAX];
+
+#if defined(USE_CAIRO_CANVAS)
+ struct {
+ cairo_surface_t *surface;
+ cairo_t *ctx;
+ } cairo;
+#endif
};
struct _port_conn_t {
@@ -508,6 +521,10 @@ struct _plughandle_t {
time_t t0;
struct nk_rect space_bounds;
+
+#if defined(USE_CAIRO_CANVAS)
+ LV2_Canvas canvas;
+#endif
};
static const char *bundle_search_labels [BUNDLE_SELECTOR_SEARCH_MAX] = {
@@ -2066,7 +2083,17 @@ _param_set_value(plughandle_t *handle, param_t *param, const LV2_Atom *value)
if(param->val.chunk.body)
memcpy(param->val.chunk.body, LV2_ATOM_BODY_CONST(value), value->size);
}
- //FIXME handle remaining types
+ else if(param->range == handle->forge.Tuple)
+ {
+ _log_warning(handle, "got tuple: %s\n",
+ handle->unmap->unmap(handle->unmap->handle, param->property));
+ //FIXME render canvas
+ }
+ else
+ {
+ _log_warning(handle, "parameter range unsupported: %s\n",
+ handle->unmap->unmap(handle->unmap->handle, param->range));
+ }
}
static void
@@ -7714,6 +7741,10 @@ instantiate(const LV2UI_Descriptor *descriptor, const char *plugin_uri,
time(&handle->t0);
srand(time(NULL));
+#if defined(USE_CAIRO_CANVAS)
+ lv2_canvas_init(&handle->canvas, handle->map);
+#endif
+
return handle;
}