aboutsummaryrefslogtreecommitdiff
path: root/monitors_midi_pianoroll.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-04-18 23:15:24 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-04-18 23:15:24 +0200
commitb7612b7ec01e275b456a1c1fd898c9af9581ace6 (patch)
treef2a117d1a16c429738b3a47804c81f289d2cc33a /monitors_midi_pianoroll.c
parent209b1c28169f9a07b13d9e95801a857bb89e90c8 (diff)
downloadmonitors.lv2-b7612b7ec01e275b456a1c1fd898c9af9581ace6.tar.xz
rotate pianoroll and exit for loops when done.
Diffstat (limited to 'monitors_midi_pianoroll.c')
-rw-r--r--monitors_midi_pianoroll.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/monitors_midi_pianoroll.c b/monitors_midi_pianoroll.c
index 06257bd..f46fbf4 100644
--- a/monitors_midi_pianoroll.c
+++ b/monitors_midi_pianoroll.c
@@ -95,7 +95,7 @@ _render(plughandle_t *handle, int64_t frames)
LV2_Canvas_URID *urid = &handle->urid;
LV2_Atom_Forge_Frame frame;
- const float dx = 1.f / 0x7f;
+ const float dy = 1.f / 0x7f;
lv2_atom_forge_set_buffer(forge, handle->state.graph, MAX_GRAPH);
@@ -103,7 +103,7 @@ _render(plughandle_t *handle, int64_t frames)
|| !lv2_canvas_forge_rectangle(forge, urid, 0.f, 0.f, 1.f, 1.f)
|| !lv2_canvas_forge_style(forge, urid, 0x0000003f)
|| !lv2_canvas_forge_fill(forge, urid)
- || !lv2_canvas_forge_lineWidth(forge, urid, dx) )
+ || !lv2_canvas_forge_lineWidth(forge, urid, dy) )
{
fprintf(stderr, "out-of-memory\n"); //FIXME
}
@@ -118,19 +118,19 @@ _render(plughandle_t *handle, int64_t frames)
return; //FIXME solve this differently
}
- float x = dx * 0.5f;
- for(unsigned i = 0; i < MAX_KEYS; i++, x+=dx)
+ float y = 1.f - dy * 0.5f;
+ for(unsigned i = 0; i < MAX_KEYS; i++, y -= dy)
{
active_note_t *active = &handle->actives[i];
passive_note_t *passives = handle->passives[i];
if(active->start != 0)
{
- const float y0 = fmaxf(0.f, range_1 * (active->start - tail));
- const float y1 = 1.f;
+ const float x0 = fmaxf(0.f, range_1 * (active->start - tail));
+ const float x1 = 1.f;
const float line [] = {
- x, y0,
- x, y1
+ x0, y,
+ x1, y
};
if( !lv2_canvas_forge_polyLine(forge, urid, 4, line)
@@ -147,7 +147,7 @@ _render(plughandle_t *handle, int64_t frames)
if(passive->start == 0)
{
- continue; // skip this key
+ break; // skip this key
}
const bool start_in_window = (passive->start > tail) && (passive->start < head);
@@ -155,15 +155,15 @@ _render(plughandle_t *handle, int64_t frames)
if(start_in_window || end_in_window)
{
- const float y0 = start_in_window
+ const float x0 = start_in_window
? range_1 * (passive->start - tail)
: 0.f;
- const float y1 = end_in_window
+ const float x1 = end_in_window
? range_1 * (passive->end - tail)
: 1.f;
const float line [] = {
- x, y0,
- x, y1
+ x0, y,
+ x1, y
};
if( !lv2_canvas_forge_polyLine(forge, urid, 4, line)