13
0

temporal: do something when pasting the cut buffer guard points

Don't think this is quite right yet - we get guard points even when
they are not really necessary
This commit is contained in:
Paul Davis 2023-06-06 09:04:16 -06:00
parent 6865615af8
commit 9e4b1d59a7
3 changed files with 35 additions and 5 deletions

View File

@ -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*

View File

@ -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<TempoPoint, boost::intrusive::base_hook<tempo_hook>> Tempos;
typedef boost::intrusive::list<MeterPoint, boost::intrusive::base_hook<meter_hook>> Meters;

View File

@ -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);