diff base/Selection.cpp @ 300:5877d68815c7

* Change WaveFileModel API from getValues(start,end) to getData(start,count). It's much less error-prone to pass in frame counts instead of start/end locations. Should have done this ages ago. This closes #1794563. * Add option to apply a transform to only the selection region, instead of the whole audio. * (to make the above work properly) Add start frame offset to wave models
author Chris Cannam
date Mon, 01 Oct 2007 13:48:38 +0000
parents d397ea0a79f5
children 70a232b1f12a
line wrap: on
line diff
--- a/base/Selection.cpp	Fri Sep 28 16:15:06 2007 +0000
+++ b/base/Selection.cpp	Mon Oct 01 13:48:38 2007 +0000
@@ -172,6 +172,25 @@
     }
 }
 
+void
+MultiSelection::getExtents(size_t &startFrame, size_t &endFrame) const
+{
+    startFrame = 0;
+    endFrame = 0;
+    
+    for (SelectionList::const_iterator i = m_selections.begin();
+	 i != m_selections.end(); ++i) {
+
+        if (i == m_selections.begin() || i->getStartFrame() < startFrame) {
+            startFrame = i->getStartFrame();
+        }
+
+        if (i == m_selections.begin() || i->getEndFrame() > endFrame) {
+            endFrame = i->getEndFrame();
+        }
+    }
+}
+
 Selection
 MultiSelection::getContainingSelection(size_t frame, bool defaultToFollowing) const
 {