Hello Jonathan and community,
I'm working on the performance issue I describe in my previous email with
note operations in the Non Sequencer (dragging a note duration or changing
velocity).
Attached is a patch I created which addresses some optimization
opportunities. Let me know if there is a more preferred way to send
patches and I'll use that in the future.
Patch details:
I added some tests to check if velocity or note duration actually changed
and only call damage_grid() if so. Also I merged the 2 calls to
damage_grid (before and after duration change) to just include the larger
of the 2 duration areas (only needed for duration change). Also processed
only gets set to 2 in the event a change is made, cutting down on an
additional damage() call in many cases.
This cuts down on a lot of excessive redraws, which makes it more usable on
my system. However the performance is still extremely poor. I noticed in
the console that draw_background() is getting called a lot, for the entire
window, which leads me to believe, that despite damage_grid() specifying a
subset region, some underlying widgets are not utilizing this and are just
redrawing the entire area. I suspect this might be an optimization
opportunity with the Fl_Panzoomer widget. Does that sound about right?
Should widgets use the underlying Fl_X->region to limit updates?
Going beyond all that, I suspect there are some rather poor performing
OpenGL related stuff with my ATI/AMD graphics drivers. Most of the other
Non applications seem to perform pretty well though. Any tips on any areas
that could use optimization would be most appreciated. I've got a lot more
learning to do in regards to NTK, as far as the whole rendering pipeline,
so if my questions seem a bit excessive, I would totally understand. My
goal is to make things easier for you and ultimately end up with a more
functional Non Sequencer :-)
Best regards,
Element
diff --git a/sequencer/src/canvas.C b/sequencer/src/canvas.C
index ba3509a..68511f3 100644
--- a/sequencer/src/canvas.C
+++ b/sequencer/src/canvas.C
@@ -1839,7 +1839,7 @@ Canvas::handle ( int m )
if ( ghost_note )
{
- damage_grid( ghost_note->start, ghost_note->note, ghost_note->duration, 1 );
+ processed = 0;
int ody = drag_y;
int odx = drag_x;
@@ -1851,14 +1851,24 @@ Canvas::handle ( int m )
/* cursor must leave the row to begin adjusting velocity. */
if ( ody != dy )
{
- ghost_note->velocity =
+ int velocity;
+
+ velocity =
drag_note->velocity +
( (drag_y - y) / 3.0f );
- if ( ghost_note->velocity < 0 )
- ghost_note->velocity = 0;
- else if ( ghost_note->velocity > 127 )
- ghost_note->velocity = 127;
+ if ( velocity < 0 )
+ velocity = 0;
+ else if ( velocity > 127 )
+ velocity = 127;
+
+ if ( ghost_note->velocity != velocity )
+ {
+ ghost_note->velocity = velocity;
+ damage_grid( ghost_note->start, ghost_note->note,
+ ghost_note->duration, 1 );
+ processed = 2;
+ }
}
}
@@ -1866,17 +1876,19 @@ Canvas::handle ( int m )
{
if ( dx > this->m.grid->ts_to_x( ghost_note->start ) )
{
- ghost_note->duration = this->m.grid->x_to_ts( dx ) - ghost_note->start;
+ tick_t duration = this->m.grid->x_to_ts( dx ) - ghost_note->start;
+
+ if ( ghost_note->duration != duration )
+ {
+ damage_grid( ghost_note->start, ghost_note->note,
+ max ( duration, ghost_note->duration ), 1 );
+ ghost_note->duration = duration;
+ processed = 2;
+ }
}
}
-
-
- damage_grid( ghost_note->start, ghost_note->note, ghost_note->duration, 1 );
delete_note = false;
-
- processed = 2;
-
}
}
break;