@@ -519,7 +519,8 @@ ossia::net::node_base* exec_state_facade::find_node(std::string_view name) const
519519auto exec_state_facade::timings (const token_request& t) const noexcept -> sample_timings
520520{
521521 sample_timings tm;
522- if (t.speed > 0 .)
522+ static constexpr double speed_epsilon = 0.01 ;
523+ if (t.speed > speed_epsilon)
523524 {
524525 [[likely]] ;
525526 tm.start_sample = t.physical_start (impl->modelToSamplesRatio );
@@ -531,13 +532,7 @@ auto exec_state_facade::timings(const token_request& t) const noexcept -> sample
531532
532533 tm.length = std::min (tick_dur, max_dur);
533534 }
534- else if (t.speed == 0 .)
535- {
536- tm.start_sample = 0 ;
537- tm.length = 0 ;
538- return tm;
539- }
540- else
535+ else if (t.speed < -speed_epsilon)
541536 {
542537 tm.start_sample = -t.physical_start (impl->modelToSamplesRatio );
543538
@@ -548,29 +543,38 @@ auto exec_state_facade::timings(const token_request& t) const noexcept -> sample
548543
549544 tm.length = std::min (tick_dur, max_dur);
550545 }
551-
546+ else
547+ {
548+ tm.start_sample = 0 ;
549+ tm.length = 0 ;
550+ return tm;
551+ }
552552 if (tm.start_sample < 0 )
553553 {
554554 [[unlikely]] ;
555- assert ( false );
555+ ossia::logger (). error ( " tm.start_sample < 0: {} " , tm. start_sample );
556556 return {};
557557 }
558558 if (tm.start_sample >= impl->bufferSize )
559559 {
560560 [[unlikely]] ;
561- assert (false );
561+ ossia::logger ().error (
562+ " tm.start_sample >= impl->bufferSize: {} >= {}" , tm.start_sample ,
563+ impl->bufferSize );
562564 return {};
563565 }
564566 if (tm.length < 0 )
565567 {
566568 [[unlikely]] ;
567- assert ( false );
569+ ossia::logger (). error ( " tm.length < 0: {} " , tm. length );
568570 return {};
569571 }
570572 if (tm.start_sample + tm.length > impl->bufferSize )
571573 {
572574 [[unlikely]] ;
573- assert (false );
575+ ossia::logger ().error (
576+ " tm.start_sample + tm.length > impl->bufferSize: {} + {} > {}" , tm.start_sample ,
577+ tm.length , impl->bufferSize );
574578 return {};
575579 }
576580 return tm;
0 commit comments