From ad45778edc4edf0f0d7f137336f072f808774fb0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 6 Jun 2023 13:30:18 -0600 Subject: [PATCH] temporal: shift() with BBT must allow negative motion --- libs/temporal/tempo.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 7fc2ed4d66..d9d6b36b55 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -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); } }