From 7422ffe6920deba396debb670c713849a64be43b Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Sun, 15 Oct 2017 17:16:27 +1100 Subject: editor_pt_import: Process wav indexes once only --- gtk2_ardour/editor_pt_import.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/editor_pt_import.cc') diff --git a/gtk2_ardour/editor_pt_import.cc b/gtk2_ardour/editor_pt_import.cc index 79dfa22f3a..470d0b43e1 100644 --- a/gtk2_ardour/editor_pt_import.cc +++ b/gtk2_ardour/editor_pt_import.cc @@ -192,11 +192,16 @@ Editor::do_ptimport (std::string ptpath, return; } + vector indexes; + vector::iterator used_idx; + for (vector::iterator a = ptf.regions.begin(); a != ptf.regions.end(); ++a) { for (vector::iterator p = ptfwavpair.begin(); p != ptfwavpair.end(); ++p) { - if ((p->index1 == a->wave.index) && (strcmp(a->wave.filename.c_str(), "") != 0)) { + + used_idx = std::find(indexes.begin(), indexes.end(), a->wave.index); + if ((p->index1 == a->wave.index) && (strcmp(a->wave.filename.c_str(), "") != 0) && used_idx == indexes.end()) { for (SourceList::iterator x = imported.begin(); x != imported.end(); ++x) { if ((*x)->id() == p->id) { @@ -223,6 +228,7 @@ Editor::do_ptimport (std::string ptpath, ptfregpair.push_back(rp); } } + indexes.push_back(a->wave.index); } } if (strcmp(a->wave.filename.c_str(), "") == 0) { -- cgit v1.2.3