From 297e146152af17b0b69be648bb3cc78bb30ba1fc Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 20 Oct 2025 14:56:18 -0600 Subject: [PATCH] use the correct region tempo map when getting BBT metric in a CueEditor --- gtk2_ardour/cue_editor.cc | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/cue_editor.cc b/gtk2_ardour/cue_editor.cc index 95bf0524d7..726995ae1f 100644 --- a/gtk2_ardour/cue_editor.cc +++ b/gtk2_ardour/cue_editor.cc @@ -1572,25 +1572,17 @@ edit_last_mark_label (std::vector& marks, const std:: void CueEditor::metric_get_bbt (std::vector& marks, samplepos_t leftmost, samplepos_t rightmost, gint /*maxchars*/) { - EC_LOCAL_TEMPO_SCOPE; + // no EC_LOCAL_TEMPO_SCOPE here since we use an explicit TempoMap for + // all calculations - if (!_session) { + if (!_session || !_region) { return; } bool provided = false; - std::shared_ptr tmap; - std::shared_ptr mr = std::dynamic_pointer_cast (_region); + std::shared_ptr tmap (_region->tempo_map()); - if (mr) { - std::shared_ptr smf (std::dynamic_pointer_cast (mr->midi_source())); - - if (smf) { - tmap = smf->tempo_map (provided); - } - } - - if (!provided) { + if (!tmap) { tmap.reset (new Temporal::TempoMap (Temporal::Tempo (120, 4), Temporal::Meter (4, 4))); }