aboutsummaryrefslogtreecommitdiff
path: root/monitors_midi_pianoroll.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitors_midi_pianoroll.c')
-rw-r--r--monitors_midi_pianoroll.c30
1 files changed, 29 insertions, 1 deletions
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),