use the correct region tempo map when getting BBT metric in a CueEditor

This commit is contained in:
Paul Davis 2025-10-20 14:56:18 -06:00
parent cab3d96a4c
commit 297e146152

View file

@ -1572,25 +1572,17 @@ edit_last_mark_label (std::vector<ArdourCanvas::Ruler::Mark>& marks, const std::
void void
CueEditor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& marks, samplepos_t leftmost, samplepos_t rightmost, gint /*maxchars*/) CueEditor::metric_get_bbt (std::vector<ArdourCanvas::Ruler::Mark>& 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; return;
} }
bool provided = false; bool provided = false;
std::shared_ptr<Temporal::TempoMap> tmap; std::shared_ptr<Temporal::TempoMap const> tmap (_region->tempo_map());
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion> (_region);
if (mr) { if (!tmap) {
std::shared_ptr<SMFSource> smf (std::dynamic_pointer_cast<SMFSource> (mr->midi_source()));
if (smf) {
tmap = smf->tempo_map (provided);
}
}
if (!provided) {
tmap.reset (new Temporal::TempoMap (Temporal::Tempo (120, 4), Temporal::Meter (4, 4))); tmap.reset (new Temporal::TempoMap (Temporal::Tempo (120, 4), Temporal::Meter (4, 4)));
} }