speed up load/quit for sessions containing ~25k events.

- MGR uses a _note_group to hold events.

	- MRV & MGR delete canvas notes directly from their note group.

	- sysex is untested (it uses MRV note group).
This commit is contained in:
nick_m 2016-12-24 02:01:37 +11:00
parent 0e8852963e
commit da92d2d764
3 changed files with 8 additions and 10 deletions

View File

@ -179,6 +179,7 @@ MidiGhostRegion::MidiGhostRegion(RegionView& rv,
TimeAxisView& source_tv,
double initial_unit_pos)
: GhostRegion(rv, tv.ghost_group(), tv, source_tv, initial_unit_pos)
, _note_group (new ArdourCanvas::Container (group))
, _optimization_iterator(events.end())
{
_outline = UIConfiguration::instance().color ("ghost track midi outline");
@ -200,6 +201,7 @@ MidiGhostRegion::MidiGhostRegion(RegionView& rv,
msv.trackview(),
source_tv,
initial_unit_pos)
, _note_group (new ArdourCanvas::Container (group))
, _optimization_iterator(events.end())
{
_outline = UIConfiguration::instance().color ("ghost track midi outline");
@ -324,7 +326,7 @@ MidiGhostRegion::update_contents_height ()
void
MidiGhostRegion::add_note (NoteBase* n)
{
GhostEvent* event = new GhostEvent (n, group);
GhostEvent* event = new GhostEvent (n, _note_group);
events.insert (make_pair (n->note(), event));
event->item->set_fill_color (UIConfiguration::instance().color_mod(n->base_color(), "ghost track midi fill"));
@ -356,12 +358,9 @@ MidiGhostRegion::add_note (NoteBase* n)
void
MidiGhostRegion::clear_events()
{
_optimization_iterator = events.begin();
while (_optimization_iterator != events.end()) {
delete (*_optimization_iterator).second;
_optimization_iterator = events.erase (_optimization_iterator);
}
_note_group->clear (true);
events.clear ();
_optimization_iterator = events.end();
}
/** Update the x positions of our representation of a parent's note.

View File

@ -116,6 +116,7 @@ public:
void clear_events();
private:
ArdourCanvas::Container* _note_group;
ArdourCanvas::Color _outline;
ArdourCanvas::Rectangle* _tmp_rect;
ArdourCanvas::Polygon* _tmp_poly;

View File

@ -978,10 +978,8 @@ MidiRegionView::clear_events ()
}
}
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
delete *i;
}
_note_group->clear (true);
_events.clear();
_patch_changes.clear();
_sys_exes.clear();