13
0

fix Region::set_position_internal() to use TempoMap provided conversions

rolling our own beat<->audio conversion code here was doomed to fail.

this fixes the absurd length of a consolidated region.
This commit is contained in:
Paul Davis 2023-09-18 19:56:06 -06:00
parent 5122036054
commit 1344851912

View File

@ -764,15 +764,11 @@ Region::set_position_internal (timepos_t const & pos)
*/
if (td != _length.val().position().time_domain()) {
switch (td) {
case Temporal::AudioTime:
_length = timecnt_t::from_superclock (superclock_t (_length.val().distance()), timepos_t::from_superclock (pos.superclocks()));
break;
default:
_length = timecnt_t::from_ticks (int64_t (_length.val().distance()), timepos_t::from_ticks (pos.ticks()));
break;
}
} else {
timecnt_t l = _length.val();
l.set_position (pos);
l.set_time_domain (td);
_length = l;
} else {
/* time domain of position not changing */
_length = timecnt_t (_length.val().distance(), pos);
}