aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-20 22:58:17 +0100
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-03-20 22:58:17 +0100
commitc9fc6ad4456d8696ab57fae18e48e3e149612479 (patch)
treea5d8c7ec2e22dc81b9ace50f16c21f348965b3bf
parentea0affcf0e1957d18be940ab4dd8dafe79991e35 (diff)
downloadvm.lv2-c9fc6ad4456d8696ab57fae18e48e3e149612479.tar.xz
use 'sanne' lv2:min/max.
-rw-r--r--VERSION2
-rw-r--r--vm.ttl84
-rw-r--r--vm_ui.c29
3 files changed, 67 insertions, 48 deletions
diff --git a/VERSION b/VERSION
index 522e679..c82b67c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.2809
+0.1.2811
diff --git a/vm.ttl b/vm.ttl
index 365680c..6242600 100644
--- a/vm.ttl
+++ b/vm.ttl
@@ -205,17 +205,17 @@ vm:vm
lv2:index 2 ;
lv2:symbol "control_in_0" ;
lv2:name "Control In 0" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
- lv2:default 0.5;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
+ lv2:default 0.0;
] , [
a lv2:InputPort,
lv2:ControlPort;
lv2:index 3 ;
lv2:symbol "control_in_1" ;
lv2:name "Control In 1" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -223,8 +223,8 @@ vm:vm
lv2:index 4 ;
lv2:symbol "control_in_2" ;
lv2:name "Control In 2" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -232,8 +232,8 @@ vm:vm
lv2:index 5 ;
lv2:symbol "control_in_3" ;
lv2:name "Control In 3" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -241,8 +241,8 @@ vm:vm
lv2:index 6 ;
lv2:symbol "control_in_4" ;
lv2:name "Control In 4" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -250,8 +250,8 @@ vm:vm
lv2:index 7 ;
lv2:symbol "control_in_5" ;
lv2:name "Control In 5" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -259,8 +259,8 @@ vm:vm
lv2:index 8 ;
lv2:symbol "control_in_6" ;
lv2:name "Control In 6" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:InputPort,
@@ -268,8 +268,8 @@ vm:vm
lv2:index 9 ;
lv2:symbol "control_in_7" ;
lv2:name "Control In 7" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
lv2:default 0.0;
] , [
a lv2:OutputPort,
@@ -277,64 +277,64 @@ vm:vm
lv2:index 10 ;
lv2:symbol "control_out_0" ;
lv2:name "Control Out 0" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 11 ;
lv2:symbol "control_out_1" ;
lv2:name "Control Out 1" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 12 ;
lv2:symbol "control_out_2" ;
lv2:name "Control Out 2" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 13 ;
lv2:symbol "control_out_3" ;
lv2:name "Control Out 3" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 14 ;
lv2:symbol "control_out_4" ;
lv2:name "Control Out 4" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 15 ;
lv2:symbol "control_out_5" ;
lv2:name "Control Out 5" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 16 ;
lv2:symbol "control_out_6" ;
lv2:name "Control Out 6" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] , [
a lv2:OutputPort,
lv2:ControlPort;
lv2:index 17 ;
lv2:symbol "control_out_7" ;
lv2:name "Control Out 7" ;
- lv2:minimum 0.0;
- lv2:maximum 1.0;
+ lv2:minimum -8192;
+ lv2:maximum 8191;
] ;
#patch:writable
@@ -360,7 +360,10 @@ vm:dBFS
a pset:Preset ;
lv2:appliesTo vm:vm ;
rdfs:label "dBFS" ;
-
+ lv2:port [
+ lv2:symbol "control_in_0" ;
+ pset:value 0.5
+ ] ;
state:state [
vm:graph [
a atom:Tuple ;
@@ -378,7 +381,10 @@ vm:lfo
a pset:Preset ;
lv2:appliesTo vm:vm ;
rdfs:label "LFO" ;
-
+ lv2:port [
+ lv2:symbol "control_in_0" ;
+ pset:value 10.0
+ ] ;
state:state [
vm:graph [
a atom:Tuple ;
@@ -401,6 +407,8 @@ vm:lfo
0 vm:opLoad
0.75 vm:opLt
vm:opAnd
+ 16383 vm:opMul
+ 8191 vm:opSub
# TriangleLFO := (Phase > 0.5 ? (1.0 - Phase) : Phase) * 2.0
1.0
@@ -411,6 +419,8 @@ vm:lfo
0.5 vm:opGt
vm:opTernary
2.0 vm:opMul
+ 16383 vm:opMul
+ 8191 vm:opSub
# SineLFO := Sin( (Phase - 0.25) * 2.0 * PI) * 0.5 + 0.5
0 vm:opLoad
@@ -420,9 +430,13 @@ vm:lfo
vm:opSin
0.5 vm:opMul
0.5 vm:opAdd
+ 16383 vm:opMul
+ 8191 vm:opSub
# push phase
0 vm:opLoad
+ 16383 vm:opMul
+ 8191 vm:opSub
)
]
] .
diff --git a/vm_ui.c b/vm_ui.c
index 0aaa7cf..6b40bb2 100644
--- a/vm_ui.c
+++ b/vm_ui.c
@@ -244,6 +244,9 @@ _draw_separator(struct nk_context *ctx, float line_width)
nk_stroke_line(canvas, x0, y, x1, y, line_width, ctx->style.window.background);
}
+#define VM_MIN -0x2000
+#define VM_MAX 0x1fff
+
static void
_expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
{
@@ -272,8 +275,8 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
snprintf(label, 16, "Input %u:", i);
const float old_val = handle->in0[i];
- nk_property_float(ctx, label, 0.f, &handle->in0[i], 1.f, 0.01f, 0.01f);
- nk_slider_float(ctx, 0.f, &handle->in0[i], 1.f, 0.001f);
+ nk_property_float(ctx, label, VM_MIN, &handle->in0[i], VM_MAX, 1.f, 1.f);
+ nk_slider_float(ctx, VM_MIN, &handle->in0[i], VM_MAX, 1.f);
if(old_val != handle->in0[i])
handle->writer(handle->controller, i + 2, sizeof(float), 0, &handle->in0[i]);
}
@@ -289,7 +292,7 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
char label [16];
snprintf(label, 16, "Output %u", i);
nk_value_float(ctx, label, handle->out0[i]);
- nk_slide_float(ctx, 0.f, handle->out0[i], 1.f, 0.001f);
+ nk_slide_float(ctx, VM_MIN, handle->out0[i], VM_MAX, 1.f);
}
nk_tree_pop(ctx);
}
@@ -321,16 +324,18 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
{
case COMMAND_BOOL:
{
- /*FIXME
- const int32_t c = ((const LV2_Atom_Bool *)item)->body;
- nk_labelf(ctx, NK_TEXT_LEFT, "%s", c ? "true" : "false");
- */
- nk_spacing(ctx, 1);
+ if(nk_button_symbol_label(ctx,
+ cmd->i32 ? NK_SYMBOL_CIRCLE_SOLID : NK_SYMBOL_CIRCLE_OUTLINE,
+ cmd->i32 ? "true" : "false", NK_TEXT_LEFT))
+ {
+ cmd->i32 = !cmd->i32;
+ sync = true;
+ }
} break;
case COMMAND_INT:
{
int i32 = cmd->i32;
- nk_property_int(ctx, "#", 0, &i32, CTRL_MAX - 1, 1, 0.01f); //FIXME
+ nk_property_int(ctx, "#", VM_MIN, &i32, VM_MAX, 1, 1.f);
if(i32 != cmd->i32)
{
cmd->i32 = i32;
@@ -340,7 +345,7 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
case COMMAND_LONG:
{
int i64 = cmd->i64;
- nk_property_int(ctx, "#", 0, &i64, CTRL_MAX - 1, 1, 0.01f); //FIXME
+ nk_property_int(ctx, "#", VM_MIN, &i64, VM_MAX, 1, 1.f);
if(i64 != cmd->i64)
{
cmd->i64 = i64;
@@ -350,7 +355,7 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
case COMMAND_FLOAT:
{
float f32 = cmd->f32;
- nk_property_float(ctx, "#", 0.f, &f32, 1.f, 0.01f, 0.01f);
+ nk_property_float(ctx, "#", VM_MIN, &f32, VM_MAX, 1.f, 1.f);
if(f32 != cmd->f32)
{
cmd->f32 = f32;
@@ -360,7 +365,7 @@ _expose(struct nk_context *ctx, struct nk_rect wbounds, void *data)
case COMMAND_DOUBLE:
{
double f64 = cmd->f64;
- nk_property_double(ctx, "#", 0.f, &f64, 1.f, 0.01f, 0.01f);
+ nk_property_double(ctx, "#", VM_MIN, &f64, VM_MAX, 1.f, 1.f);
if(f64 != cmd->f64)
{
cmd->f64 = f64;