use Meter::round_to_bar() rather than BBT_Time::round_(up|down)_to_bar
this gives slightly better behavior when dragging a meter marker
This commit is contained in:
parent
64458c2430
commit
afe74bb460
@ -1920,7 +1920,7 @@ TempoMap::reset_section (Points::iterator& begin, Points::iterator& end, supercl
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool earlier, bool push)
|
TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool push)
|
||||||
{
|
{
|
||||||
TEMPO_MAP_ASSERT (!_tempos.empty());
|
TEMPO_MAP_ASSERT (!_tempos.empty());
|
||||||
TEMPO_MAP_ASSERT (!_meters.empty());
|
TEMPO_MAP_ASSERT (!_meters.empty());
|
||||||
@ -1933,16 +1933,9 @@ TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool earlie
|
|||||||
superclock_t sc;
|
superclock_t sc;
|
||||||
Beats beats;
|
Beats beats;
|
||||||
BBT_Time bbt;
|
BBT_Time bbt;
|
||||||
bool round_up;
|
|
||||||
|
|
||||||
beats = when.beats ();
|
beats = when.beats ();
|
||||||
|
|
||||||
if (earlier) {
|
|
||||||
round_up = false;
|
|
||||||
} else {
|
|
||||||
round_up = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do not allow moving a meter marker to the same position as
|
/* Do not allow moving a meter marker to the same position as
|
||||||
* an existing one.
|
* an existing one.
|
||||||
*/
|
*/
|
||||||
@ -1965,11 +1958,8 @@ TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool earlie
|
|||||||
TempoMetric metric (*prev_t, *prev_m);
|
TempoMetric metric (*prev_t, *prev_m);
|
||||||
bbt = metric.bbt_at (beats);
|
bbt = metric.bbt_at (beats);
|
||||||
|
|
||||||
if (round_up) {
|
bbt = metric.round_to_bar (bbt);
|
||||||
bbt = bbt.round_up_to_bar ();
|
|
||||||
} else {
|
|
||||||
bbt = bbt.round_down_to_bar ();
|
|
||||||
}
|
|
||||||
/* Now find the correct TempoMetric for the new BBT position (which may
|
/* Now find the correct TempoMetric for the new BBT position (which may
|
||||||
* differ from the one we determined earlier.
|
* differ from the one we determined earlier.
|
||||||
*
|
*
|
||||||
@ -1982,6 +1972,7 @@ TempoMap::move_meter (MeterPoint const & mp, timepos_t const & when, bool earlie
|
|||||||
for (t = _tempos.begin(), prev_t = _tempos.end(); t != _tempos.end() && t->bbt() < bbt && t->beats() < beats; ++t) { prev_t = t; }
|
for (t = _tempos.begin(), prev_t = _tempos.end(); t != _tempos.end() && t->bbt() < bbt && t->beats() < beats; ++t) { prev_t = t; }
|
||||||
for (m = _meters.begin(), prev_m = _meters.end(); m != _meters.end() && m->bbt() < bbt && *m != mp; ++m) { prev_m = m; }
|
for (m = _meters.begin(), prev_m = _meters.end(); m != _meters.end() && m->bbt() < bbt && *m != mp; ++m) { prev_m = m; }
|
||||||
|
|
||||||
|
|
||||||
if (prev_m == _meters.end()) {
|
if (prev_m == _meters.end()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
|
|||||||
|
|
||||||
/* these are a convenience method that just wrap some odd semantics */
|
/* these are a convenience method that just wrap some odd semantics */
|
||||||
LIBTEMPORAL_API bool move_tempo (TempoPoint const & point, timepos_t const & destination, bool push = false);
|
LIBTEMPORAL_API bool move_tempo (TempoPoint const & point, timepos_t const & destination, bool push = false);
|
||||||
LIBTEMPORAL_API bool move_meter (MeterPoint const & point, timepos_t const & destination, bool earlier, bool push = false);
|
LIBTEMPORAL_API bool move_meter (MeterPoint const & point, timepos_t const & destination, bool push = false);
|
||||||
|
|
||||||
LIBTEMPORAL_API int set_state (XMLNode const&, int version);
|
LIBTEMPORAL_API int set_state (XMLNode const&, int version);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user