From 9adc336d5004f7d30f743f15715346fefdba3d8d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 11 Oct 2021 17:25:07 -0600 Subject: [PATCH] control surfaces: fix BasicUI::jump_by_bars() to use tempo map correctly --- libs/surfaces/control_protocol/basic_ui.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index cfd929b50f..8f439267e0 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -548,19 +548,15 @@ BasicUI::jump_by_seconds (double secs, LocateTransportDisposition ltd) void BasicUI::jump_by_bars (int bars, LocateTransportDisposition ltd) { - TempoMap::SharedPtr tmap (TempoMap::use()); + TempoMap::SharedPtr tmap (TempoMap::fetch()); Temporal::BBT_Time bbt (tmap->bbt_at (timepos_t (session->transport_sample()))); - bars += bbt.bars; - if (bars < 0) { - bars = 0; + bbt.bars += bbt.bars; + if (bbt.bars < 0) { + bbt.bars = 1; } - AnyTime any; - any.type = AnyTime::BBT; - any.bbt.bars = bars; - - session->request_locate (session->convert_to_samples (any), ltd); + session->request_locate (tmap->sample_at (bbt, session->sample_rate()), ltd); } void