aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-08-30 16:49:07 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-08-30 16:49:07 +0200
commitb2a4fd45e93f4cd9f4f5304882067f2f25f8a996 (patch)
tree4991371157a55a6eb0e5a71abb18a11b0faea186
parentbdbaebd1c54d72c0f8153b6f04e3e31c0a1a972b (diff)
downloadsynthpod-b2a4fd45e93f4cd9f4f5304882067f2f25f8a996.tar.xz
nk: prototype volume dial in audio/cv connections.
-rw-r--r--VERSION2
-rw-r--r--plugins/synthpod_common_nk.c27
2 files changed, 26 insertions, 3 deletions
diff --git a/VERSION b/VERSION
index e18573af..f03f2d46 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5219
+0.1.5221
diff --git a/plugins/synthpod_common_nk.c b/plugins/synthpod_common_nk.c
index 2fd0a253..28cf0d5e 100644
--- a/plugins/synthpod_common_nk.c
+++ b/plugins/synthpod_common_nk.c
@@ -5368,6 +5368,8 @@ _expose_mod_conn(plughandle_t *handle, struct nk_context *ctx, struct nk_rect sp
if(!_source_type_match(handle, mod_conn->source_type) || !_sink_type_match(handle, mod_conn->sink_type))
return;
+ const bool is_dial = (handle->type == PROPERTY_TYPE_AUDIO) || (handle->type == PROPERTY_TYPE_CV);
+
struct nk_input *in = &ctx->input;
struct nk_command_buffer *canvas = nk_window_get_canvas(ctx);
const struct nk_vec2 scrolling = handle->scrolling;
@@ -5381,7 +5383,7 @@ _expose_mod_conn(plughandle_t *handle, struct nk_context *ctx, struct nk_rect sp
const unsigned nx = _mod_num_sources(mod_conn->source_mod, handle->type);
const unsigned ny = _mod_num_sinks(mod_conn->sink_mod, handle->type);
- const float ps = 16.f * handle->scale;
+ const float ps = (is_dial ? 24.f : 16.f) * handle->scale;
const float pw = nx * ps;
const float ph = ny * ps;
struct nk_rect bounds = nk_rect(
@@ -5535,7 +5537,28 @@ _expose_mod_conn(plughandle_t *handle, struct nk_context *ctx, struct nk_rect sp
port_conn_t *port_conn = _port_conn_find(mod_conn, source_port, sink_port);
if(port_conn)
- nk_fill_arc(canvas, x, y, cs, 0.f, 2*NK_PI, toggle_color);
+ {
+ if(is_dial)
+ {
+ const float alpha = 1.f; //FIXME
+ const float beta = NK_PI/2;
+
+ nk_stroke_arc(canvas,
+ x, y, 10.f * handle->scale,
+ beta + 0.2f*NK_PI, beta + 1.8f*NK_PI,
+ 1.f,
+ style->border_color);
+ nk_stroke_arc(canvas,
+ x, y, 7.f * handle->scale,
+ beta + 0.2f*NK_PI, beta + (0.2f + alpha*1.6f)*NK_PI,
+ 2.f,
+ toggle_color);
+ }
+ else // !is_dial
+ {
+ nk_fill_arc(canvas, x, y, cs, 0.f, 2*NK_PI, toggle_color);
+ }
+ }
const struct nk_rect tile = nk_rect(x - ps/2, y - ps/2, ps, ps);