return two iterators into the Bars|Beats list of the tempo map rather than making a copy; use iterators in the GUI

git-svn-id: svn://localhost/ardour2/branches/3.0@11146 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-01-03 18:43:58 +00:00
parent 0d4658e0af
commit 2a200bdc0e
9 changed files with 55 additions and 52 deletions

View file

@ -227,7 +227,9 @@ class TempoMap : public PBD::StatefulDestructible
}
const BBTPointList& map() const { return _map ; }
void map (BBTPointList&, framepos_t start, framepos_t end);
void map (BBTPointList::const_iterator&, BBTPointList::const_iterator&,
framepos_t start, framepos_t end);
void bbt_time (framepos_t when, Timecode::BBT_Time&);
framecnt_t frame_time (const Timecode::BBT_Time&);

View file

@ -41,7 +41,8 @@ Pool Click::pool ("click", sizeof (Click), 128);
void
Session::click (framepos_t start, framecnt_t nframes)
{
TempoMap::BBTPointList points;
TempoMap::BBTPointList::const_iterator points_begin;
TempoMap::BBTPointList::const_iterator points_end;
Sample *buf;
if (_click_io == 0) {
@ -59,13 +60,13 @@ Session::click (framepos_t start, framecnt_t nframes)
BufferSet& bufs = get_scratch_buffers(ChanCount(DataType::AUDIO, 1));
buf = bufs.get_audio(0).data();
_tempo_map->map (points, start, end);
_tempo_map->map (points_begin, points_end, start, end);
if (points.empty()) {
if (distance (points_begin, points_end) == 0) {
goto run_clicks;
}
for (TempoMap::BBTPointList::iterator i = points.begin(); i != points.end(); ++i) {
for (TempoMap::BBTPointList::const_iterator i = points_begin; i != points_end; ++i) {
switch ((*i).type) {
case TempoMap::Beat:
if (click_emphasis_data == 0 || (click_emphasis_data && (*i).beat != 1)) {

View file

@ -1409,21 +1409,16 @@ TempoMap::round_to_type (framepos_t frame, int dir, BBTPointType type)
}
void
TempoMap::map (TempoMap::BBTPointList& points, framepos_t lower, framepos_t upper)
TempoMap::map (TempoMap::BBTPointList::const_iterator& begin,
TempoMap::BBTPointList::const_iterator& end,
framepos_t lower, framepos_t upper)
{
if (_map.empty() || upper >= _map.back().frame) {
recompute_map (false, upper);
}
for (BBTPointList::const_iterator i = _map.begin(); i != _map.end(); ++i) {
if ((*i).frame < lower) {
continue;
}
if ((*i).frame >= upper) {
break;
}
points.push_back (*i);
}
begin = lower_bound (_map.begin(), _map.end(), lower);
end = upper_bound (_map.begin(), _map.end(), upper);
}
const TempoSection&