diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 5db149528c..24ad8f0973 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -956,6 +956,21 @@ TempoMap::paste (TempoMapCutBuffer const & cb, timepos_t const & position, bool * meters, bartimes separately. */ + const BBT_Time pos_bbt = bbt_at (position); + const Beats pos_beats = quarters_at (position); + + Tempo const * st = cb.start_tempo(); + if (st) { + TempoPoint *ntp = new TempoPoint (*this, *st, position.superclocks(), pos_beats, pos_bbt); + core_add_tempo (ntp, replaced_ignored); + } + + Meter const * mt = cb.start_meter(); + if (mt) { + MeterPoint *ntp = new MeterPoint (*this, *mt, position.superclocks(), pos_beats, pos_bbt); + core_add_meter (ntp, replaced_ignored); + } + for (auto const & p : cb.points()) { TempoPoint const * tp; MeterPoint const * mp; @@ -977,6 +992,18 @@ TempoMap::paste (TempoMapCutBuffer const & cb, timepos_t const & position, bool } } } + + st = cb.end_tempo(); + if (st) { + TempoPoint *ntp = new TempoPoint (*this, *st, position.superclocks(), pos_beats, pos_bbt); + core_add_tempo (ntp, replaced_ignored); + } + mt = cb.end_meter(); + if (mt) { + MeterPoint *ntp = new MeterPoint (*this, *mt, position.superclocks(), pos_beats, pos_bbt); + core_add_meter (ntp, replaced_ignored); + } + } MeterPoint* diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index 37ffd811c4..03b5145402 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -1165,12 +1165,12 @@ class LIBTEMPORAL_API TempoMapCutBuffer void add_end_tempo (Tempo const & t); void add_start_meter (Meter const & t); void add_end_meter (Meter const & t); - - Tempo const * tempo_at_start () const { return _start_tempo; } - Tempo const * tempo_at_end () const { return _end_tempo; } - Meter const * meter_at_start () const { return _start_meter; } - Meter const * meter_at_end () const { return _end_meter; } + Tempo const * start_tempo () const { return _start_tempo; } + Tempo const * end_tempo () const { return _end_tempo; } + + Meter const * start_meter () const { return _start_meter; } + Meter const * end_meter () const { return _end_meter; } typedef boost::intrusive::list> Tempos; typedef boost::intrusive::list> Meters; diff --git a/libs/temporal/test/TempoMapCutBufferTest.cc b/libs/temporal/test/TempoMapCutBufferTest.cc index 5ac8fbe5f1..262efbd57f 100644 --- a/libs/temporal/test/TempoMapCutBufferTest.cc +++ b/libs/temporal/test/TempoMapCutBufferTest.cc @@ -35,6 +35,9 @@ TempoMapCutBufferTest::cutTest() timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (31, 1, 0))), false); + std::cerr << "Cut Buffer:\n"; + cb->dump (std::cerr); + std::cerr << "After cut\n"; tmap->dump (std::cerr);