temporal: shift() with BBT must allow negative motion

This commit is contained in:
Paul Davis 2023-06-06 13:30:18 -06:00
parent a456a10cdf
commit ad45778edc
1 changed files with 2 additions and 2 deletions

View File

@ -1038,7 +1038,7 @@ TempoMap::shift (timepos_t const & at, timecnt_t const & by)
void
TempoMap::shift (timepos_t const & at, BBT_Offset const & offset)
{
if (offset.bars < 1) {
if (std::abs (offset.bars) < 1) {
return;
}
@ -1050,7 +1050,7 @@ TempoMap::shift (timepos_t const & at, BBT_Offset const & offset)
for (auto & p : _points) {
if (p.sclock() < at_superclocks) {
BBT_Time new_bbt (p.bbt().bars + offset.bars, p.bbt().beats, p.bbt().ticks);
BBT_Time new_bbt (std::max (0, p.bbt().bars + offset.bars), p.bbt().beats, p.bbt().ticks);
p.set (p.sclock(), p.beats(), new_bbt);
}
}