comparison 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
comparison
equal deleted inserted replaced
299:576be0d0d218 300:5877d68815c7
170 if (!m_selections.empty()) { 170 if (!m_selections.empty()) {
171 m_selections.clear(); 171 m_selections.clear();
172 } 172 }
173 } 173 }
174 174
175 void
176 MultiSelection::getExtents(size_t &startFrame, size_t &endFrame) const
177 {
178 startFrame = 0;
179 endFrame = 0;
180
181 for (SelectionList::const_iterator i = m_selections.begin();
182 i != m_selections.end(); ++i) {
183
184 if (i == m_selections.begin() || i->getStartFrame() < startFrame) {
185 startFrame = i->getStartFrame();
186 }
187
188 if (i == m_selections.begin() || i->getEndFrame() > endFrame) {
189 endFrame = i->getEndFrame();
190 }
191 }
192 }
193
175 Selection 194 Selection
176 MultiSelection::getContainingSelection(size_t frame, bool defaultToFollowing) const 195 MultiSelection::getContainingSelection(size_t frame, bool defaultToFollowing) const
177 { 196 {
178 // This scales very badly with the number of selections, but it's 197 // This scales very badly with the number of selections, but it's
179 // more efficient for very small numbers of selections than a more 198 // more efficient for very small numbers of selections than a more