aboutsummaryrefslogtreecommitdiff
path: root/monitors_midi_pianoroll.c
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2018-04-21 12:42:56 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2018-04-21 12:42:56 +0200
commit22271a7973f83c93a9929f4360b09bb09427fe6a (patch)
tree14de32dd62661d269283695ac9068f556acb0749 /monitors_midi_pianoroll.c
parent4b3679cc7395ffce3a3649eca300a6f9e3d4b1c1 (diff)
downloadmonitors.lv2-22271a7973f83c93a9929f4360b09bb09427fe6a.tar.xz
fix windowing in midi pianoroll.
Diffstat (limited to 'monitors_midi_pianoroll.c')
-rw-r--r--monitors_midi_pianoroll.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/monitors_midi_pianoroll.c b/monitors_midi_pianoroll.c
index 6b283e2..5bad223 100644
--- a/monitors_midi_pianoroll.c
+++ b/monitors_midi_pianoroll.c
@@ -126,7 +126,10 @@ _render(plughandle_t *handle, int64_t frames)
if(active->start != 0)
{
- const float x0 = fmaxf(0.f, range_1 * (active->start - tail));
+ const bool start_in_window = (active->start >= tail) && (active->start <= head);
+ const float x0 = start_in_window
+ ? range_1 * (active->start - tail)
+ : 0.f;
const float x1 = 1.f;
const float line [] = {
x0, y,
@@ -151,11 +154,11 @@ _render(plughandle_t *handle, int64_t frames)
break; // skip this key
}
- const bool end_in_window = (passive->end > tail) && (passive->end < head);
+ const bool end_in_window = (passive->end >= tail) && (passive->end <= head);
if(end_in_window)
{
- const bool start_in_window = (passive->start > tail) && (passive->start < head);
+ const bool start_in_window = (passive->start >= tail) && (passive->start <= head);
const float x0 = start_in_window
? range_1 * (passive->start - tail)
: 0.f;