evoral: change how we specify a zero min_x_delta to rt_safe_earliest_event_linear_unlocked

See comment in the code for more details.
This commit is contained in:
Paul Davis 2022-03-26 21:42:28 -06:00
parent dae649d79c
commit 256e6f97a2
2 changed files with 14 additions and 2 deletions

View File

@ -1652,7 +1652,19 @@ ControlList::rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const &
{
timepos_t start = start_time;
// cout << "earliest_event(start: " << start << ", x: " << x << ", y: " << y << ", inclusive: " << inclusive << ")" << endl;
/* the max value is given as an out-of-bounds default value, when the
true default is zero, but the time-domain is not known at compile
time. This allows us to reset it to zero with the correct time
domain (equality comparisons across time domains where the actual
scalar value is zero should always be cheap, but that's not true of
other operators such as >, < etc.)
*/
if (min_x_delta == Temporal::timecnt_t::max()) {
min_x_delta = Temporal::timecnt_t (time_domain());
}
// cout << "earliest_event(start: " << start << ", x: " << x << ", y: " << y << ", inclusive: " << inclusive << ") mxd " << min_x_delta << endl;
const_iterator length_check_iter = _events.begin();
if (_events.empty()) { // 0 events

View File

@ -308,7 +308,7 @@ public:
double unlocked_eval (Temporal::timepos_t const & x) const;
bool rt_safe_earliest_event_discrete_unlocked (Temporal::timepos_t const & start, Temporal::timepos_t & x, double& y, bool inclusive) const;
bool rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const & start, Temporal::timepos_t & x, double& y, bool inclusive, Temporal::timecnt_t min_x_delta = Temporal::timecnt_t ()) const;
bool rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const & start, Temporal::timepos_t & x, double& y, bool inclusive, Temporal::timecnt_t min_x_delta = Temporal::timecnt_t::max()) const;
void create_curve();
void destroy_curve();