mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
libtemporal: improve TempoMap::get_grid()'s decision making about what bar points to include when bar_mod == 1
This commit is contained in:
parent
877e896caf
commit
0667a50a11
1 changed files with 30 additions and 11 deletions
|
|
@ -1661,6 +1661,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
assert (!_points.empty());
|
assert (!_points.empty());
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Grid, string_compose (">>> GRID START %1 .. %2 (barmod = %3)\n", start, end, bar_mod));
|
DEBUG_TRACE (DEBUG::Grid, string_compose (">>> GRID START %1 .. %2 (barmod = %3)\n", start, end, bar_mod));
|
||||||
|
dump (cout);
|
||||||
|
|
||||||
TempoPoint* tp = 0;
|
TempoPoint* tp = 0;
|
||||||
MeterPoint* mp = 0;
|
MeterPoint* mp = 0;
|
||||||
|
|
@ -1827,13 +1828,18 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
|
|
||||||
/* add point to grid, perhaps */
|
/* add point to grid, perhaps */
|
||||||
|
|
||||||
if ((bar_mod != 0) && bbt.is_bar() && (bbt.bars % bar_mod != 0)) {
|
if (bar_mod != 0) {
|
||||||
|
if (bbt.is_bar() && (bar_mod == 1 || ((bbt.bars % bar_mod == 0)))) {
|
||||||
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("G %1\t %2\n", metric, ret.back()));
|
||||||
|
} else {
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("-- skip %1 not on bar_mod %2\n", bbt, bar_mod));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("G %1\t %2\n", metric, ret.back()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
superclock_t step;
|
superclock_t step;
|
||||||
|
|
||||||
if (bar_mod == 0) {
|
if (bar_mod == 0) {
|
||||||
|
|
@ -1851,7 +1857,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
|
|
||||||
bbt.bars += bar_mod;
|
bbt.bars += bar_mod;
|
||||||
start = metric.superclock_at (bbt);
|
start = metric.superclock_at (bbt);
|
||||||
DEBUG_TRACE (DEBUG::Grid, string_compose ("bar mod %1 moved to %2\n", bar_mod, bbt))
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("bar mod %1 moved to %2 (start %3)\n", bar_mod, bbt, start))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1861,6 +1867,7 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("stopped fill with start %1 and point at %2\n", start, (p == _points.end() ? -1 : p->sclock())));
|
||||||
|
|
||||||
while ((p != _points.end()) && (start >= p->sclock())) {
|
while ((p != _points.end()) && (start >= p->sclock())) {
|
||||||
|
|
||||||
|
|
@ -1874,10 +1881,16 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
bbt = p->bbt();
|
bbt = p->bbt();
|
||||||
beats = p->beats();
|
beats = p->beats();
|
||||||
|
|
||||||
if ((bar_mod != 0) && bbt.is_bar() && (bbt.bars % bar_mod != 0)) {
|
if (bar_mod != 0) {
|
||||||
|
if (bbt.is_bar() && (bar_mod == 1 || ((bbt.bars % bar_mod == 0)))) {
|
||||||
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("G %1\t %2\n", metric, ret.back()));
|
||||||
|
} else {
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("-- skip %1 not on bar_mod %2\n", bbt, bar_mod));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("G %1\t %2\n", metric, ret.back()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* But there may be multiple points here, and we have
|
/* But there may be multiple points here, and we have
|
||||||
|
|
@ -1926,9 +1939,6 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
*/
|
*/
|
||||||
|
|
||||||
metric = TempoMetric (*tp, *mp);
|
metric = TempoMetric (*tp, *mp);
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Grid, string_compose ("G %1\t %2\n", metric, ret.back()));
|
|
||||||
|
|
||||||
p = nxt;
|
p = nxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1957,8 +1967,17 @@ TempoMap::get_grid (TempoMapPoints& ret, superclock_t start, superclock_t end, u
|
||||||
|
|
||||||
do {
|
do {
|
||||||
const Temporal::Beats beats = metric.quarters_at_superclock (start);
|
const Temporal::Beats beats = metric.quarters_at_superclock (start);
|
||||||
|
|
||||||
|
if (bar_mod != 0) {
|
||||||
|
if (bbt.is_bar() && (bar_mod == 1 || ((bbt.bars % bar_mod == 0)))) {
|
||||||
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
DEBUG_TRACE (DEBUG::Grid, string_compose ("Gend %1\t %2\n", metric, ret.back()));
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("Gend %1\t %2\n", metric, ret.back()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.push_back (TempoMapPoint (*this, metric, start, beats, bbt));
|
||||||
|
DEBUG_TRACE (DEBUG::Grid, string_compose ("Gend %1\t %2\n", metric, ret.back()));
|
||||||
|
}
|
||||||
|
|
||||||
start += step;
|
start += step;
|
||||||
bbt = metric.bbt_at (start);
|
bbt = metric.bbt_at (start);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue