aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-05-07 19:27:31 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-05-07 19:27:31 +0200
commit349abae396de20cd79de9f3837fb5b0042cc3b62 (patch)
treea63396a6cf0ed03fe1a67c8b2c4f250ec7413026
parentfe6172e7bb997576516154bcb671e2c430dbb946 (diff)
downloadmonitors.lv2-349abae396de20cd79de9f3837fb5b0042cc3b62.tar.xz
implement horizontal/vertical flip.
-rw-r--r--manifest.ttl.in10
-rw-r--r--monitors.h2
-rw-r--r--monitors.ttl22
-rw-r--r--monitors_midi_pianoroll.c30
4 files changed, 58 insertions, 6 deletions
diff --git a/manifest.ttl.in b/manifest.ttl.in
index 60eb1a0..22796e9 100644
--- a/manifest.ttl.in
+++ b/manifest.ttl.in
@@ -19,7 +19,7 @@
@prefix ui: <http://lv2plug.in/ns/extensions/ui#> .
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
-@prefix canvas: <http://open-music-kontrollers.ch/lv2/canvas#> .
+@prefix canvasdisp: <http://open-music-kontrollers.ch/lv2/canvas_display#> .
@prefix monitors: <http://open-music-kontrollers.ch/lv2/monitors#> .
# Audio Wave Mono
@@ -28,7 +28,7 @@ monitors:audio_wave_mono
lv2:minorVersion @MINOR_VERSION@ ;
lv2:microVersion @MICRO_VERSION@ ;
lv2:binary <monitors@MODULE_SUFFIX@> ;
- ui:ui canvas:canvas_ui ;
+ ui:ui canvasdisp:canvas_ui ;
rdfs:seeAlso <monitors.ttl> .
# Audio Wave Stereo
@@ -37,7 +37,7 @@ monitors:audio_wave_stereo
lv2:minorVersion @MINOR_VERSION@ ;
lv2:microVersion @MICRO_VERSION@ ;
lv2:binary <monitors@MODULE_SUFFIX@> ;
- ui:ui canvas:canvas_ui ;
+ ui:ui canvasdisp:canvas_ui ;
rdfs:seeAlso <monitors.ttl> .
# MIDI Pianoroll
@@ -46,11 +46,11 @@ monitors:midi_pianoroll
lv2:minorVersion @MINOR_VERSION@ ;
lv2:microVersion @MICRO_VERSION@ ;
lv2:binary <monitors@MODULE_SUFFIX@> ;
- ui:ui canvas:canvas_ui ;
+ ui:ui canvasdisp:canvas_ui ;
rdfs:seeAlso <monitors.ttl> .
# UI
-canvas:canvas_ui
+canvasdisp:canvas_ui
a ui:UI ;
ui:portNotification [
ui:plugin monitors:audio_wave_mono ;
diff --git a/monitors.h b/monitors.h
index 8354515..230d3b8 100644
--- a/monitors.h
+++ b/monitors.h
@@ -48,6 +48,8 @@
// paramer uris
#define MONITORS__window MONITORS_PREFIX"window"
#define MONITORS__rotation MONITORS_PREFIX"rotation"
+#define MONITORS__horizontalFlip MONITORS_PREFIX"horizontalFlip"
+#define MONITORS__verticalFlip MONITORS_PREFIX"verticalFlip"
extern const LV2_Descriptor monitors_audio_wave_mono;
extern const LV2_Descriptor monitors_audio_wave_stereo;
diff --git a/monitors.ttl b/monitors.ttl
index fe660ed..5576d8b 100644
--- a/monitors.ttl
+++ b/monitors.ttl
@@ -71,6 +71,16 @@ monitors:rotation
lv2:minimum 0.0 ;
lv2:maximum 360.0 ;
units:unit units:degree .
+monitors:horizontalFlip
+ a lv2:Parameter ;
+ rdfs:label "Horizontal flip" ;
+ rdfs:comment "toggle horizontal flip" ;
+ rdfs:range atom:Bool .
+monitors:verticalFlip
+ a lv2:Parameter ;
+ rdfs:label "Vertical flip" ;
+ rdfs:comment "toggle vertical flip" ;
+ rdfs:range atom:Bool .
monitors:window
a lv2:Parameter ;
rdfs:label "Window" ;
@@ -131,11 +141,15 @@ monitors:audio_wave_mono
patch:writable
canvas:aspectRatio ,
monitors:rotation ,
+ monitors:horizontalFlip ,
+ monitors:verticalFlip ,
monitors:window ;
state:state [
canvas:aspectRatio "1.6"^^xsd:float ;
monitors:rotation "0.0"^^xsd:float ;
+ monitors:horizontalFlip false ;
+ monitors:verticalFlip false ;
monitors:window "1000"^^xsd:int ;
] .
@@ -202,11 +216,15 @@ monitors:audio_wave_stereo
patch:writable
canvas:aspectRatio ,
monitors:rotation ,
+ monitors:horizontalFlip ,
+ monitors:verticalFlip ,
monitors:window ;
state:state [
canvas:aspectRatio "1.6"^^xsd:float ;
monitors:rotation "0.0"^^xsd:float ;
+ monitors:horizontalFlip false ;
+ monitors:verticalFlip false ;
monitors:window "1000"^^xsd:int ;
] .
@@ -251,10 +269,14 @@ monitors:midi_pianoroll
patch:writable
canvas:aspectRatio ,
monitors:rotation ,
+ monitors:horizontalFlip ,
+ monitors:verticalFlip ,
monitors:window ;
state:state [
canvas:aspectRatio "1.0"^^xsd:float ;
monitors:rotation "0.0"^^xsd:float ;
+ monitors:horizontalFlip false ;
+ monitors:verticalFlip false ;
monitors:window "1000"^^xsd:int ;
] .
diff --git a/monitors_midi_pianoroll.c b/monitors_midi_pianoroll.c
index f73b398..1234a2b 100644
--- a/monitors_midi_pianoroll.c
+++ b/monitors_midi_pianoroll.c
@@ -26,7 +26,7 @@
#include <canvas.lv2/forge.h>
#define MAX_GRAPH 0x20000 //FIXME actually measure this
-#define MAX_NPROPS 4
+#define MAX_NPROPS 6
#define MAX_KEYS 0x80
#define MAX_NOTES 0x80
#define MAX_VELOCITY 0x80
@@ -52,6 +52,8 @@ struct _passive_note_t {
struct _plugstate_t {
int32_t window;
float rotation;
+ int32_t hflip;
+ int32_t vflip;
float aspect_ratio;
uint8_t graph [MAX_GRAPH];
};
@@ -114,6 +116,22 @@ _render(plughandle_t *handle, int64_t frames)
fprintf(stderr, "out-of-memory\n"); //FIXME
}
+ if(handle->state.hflip || handle->state.vflip)
+ {
+ const float xx = handle->state.hflip ? -1.f : 1.f;
+ const float xy = 0.f;
+ const float x0 = handle->state.hflip ? 1.f : 0.f;
+
+ const float yy = handle->state.vflip ? -1.f : 1.f;
+ const float yx = 0.f;
+ const float y0 = handle->state.vflip ? 1.f : 0.f;
+
+ if( !lv2_canvas_forge_transform(forge, urid, xx, xy, x0, yy, yx, y0) )
+ {
+ fprintf(stderr, "out-of-memory\n"); //FIXME
+ }
+ }
+
if( (fmod(handle->state.rotation, 360.f) != 0.f) )
{
const float rot = handle->state.rotation / 180.f * M_PI;
@@ -242,6 +260,16 @@ static const props_def_t defs [MAX_NPROPS] = {
.type = LV2_ATOM__Float
},
{
+ .property = MONITORS__horizontalFlip,
+ .offset = offsetof(plugstate_t, hflip),
+ .type = LV2_ATOM__Bool
+ },
+ {
+ .property = MONITORS__verticalFlip,
+ .offset = offsetof(plugstate_t, vflip),
+ .type = LV2_ATOM__Bool
+ },
+ {
.access = LV2_PATCH__readable,
.property = CANVAS__graph,
.offset = offsetof(plugstate_t, graph),