13
0

Bug fixes to find_next_region_boundary (), unless I'm missing something.

git-svn-id: svn://localhost/ardour2/branches/3.0@4362 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2008-12-31 18:43:38 +00:00
parent ca21a5ac7b
commit 538cf8609a

View File

@ -1665,10 +1665,6 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir)
boost::shared_ptr<Region> r = (*i); boost::shared_ptr<Region> r = (*i);
nframes64_t distance; nframes64_t distance;
nframes64_t end = r->position() + r->length();
bool reset;
reset = false;
if (r->first_frame() > frame) { if (r->first_frame() > frame) {
@ -1677,24 +1673,18 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir)
if (distance < closest) { if (distance < closest) {
ret = r->first_frame(); ret = r->first_frame();
closest = distance; closest = distance;
reset = true;
} }
} }
if (end > frame) { if (r->last_frame () > frame) {
distance = end - frame; distance = r->last_frame () - frame;
if (distance < closest) { if (distance < closest) {
ret = end; ret = r->last_frame ();
closest = distance; closest = distance;
reset = true;
} }
} }
if (reset) {
break;
}
} }
} else { } else {
@ -1703,9 +1693,6 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir)
boost::shared_ptr<Region> r = (*i); boost::shared_ptr<Region> r = (*i);
nframes64_t distance; nframes64_t distance;
bool reset;
reset = false;
if (r->last_frame() < frame) { if (r->last_frame() < frame) {
@ -1714,23 +1701,18 @@ Playlist::find_next_region_boundary (nframes64_t frame, int dir)
if (distance < closest) { if (distance < closest) {
ret = r->last_frame(); ret = r->last_frame();
closest = distance; closest = distance;
reset = true;
} }
} }
if (r->first_frame() < frame) { if (r->first_frame() < frame) {
distance = frame - r->last_frame();
distance = frame - r->first_frame();
if (distance < closest) { if (distance < closest) {
ret = r->first_frame(); ret = r->first_frame();
closest = distance; closest = distance;
reset = true;
} }
} }
if (reset) {
break;
}
} }
} }