From cfca2d2af9d82ca6792695cde1507e3bcc2b7078 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 14 May 2023 19:07:57 +0200 Subject: [PATCH] Significantly speed up multiple region duplication When multiple regions are duplicated Playlist::duplicate is called sequentially for each region. Previously that lead to a call to Playlist::flush_notifications after each step, which is rather expensive. Playlist::ContentsChanged and Playlist::LayeringChanged trigger SessionEvent::Overwrite and GUI updates. --- gtk2_ardour/editor_ops.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index ce5c890e6d..d9ab4eae51 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5343,6 +5343,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times) /* successfully inserted into set, so it's the first time we've seen this playlist */ playlist->clear_changes (); playlist->clear_owned_changes (); + playlist->freeze (); } } @@ -5383,6 +5384,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times) if (playlists.insert (playlist).second) { playlist->clear_changes (); playlist->clear_owned_changes (); + playlist->freeze (); } } @@ -5394,6 +5396,7 @@ Editor::duplicate_some_regions (RegionSelection& regions, float times) } for (PlaylistSet::iterator p = playlists.begin(); p != playlists.end(); ++p) { + (*p)->thaw (); (*p)->rdiff_and_add_command (_session); }