Show correct bbt representation of region length in region list.
authornick_m <mainsbridge@gmail.com>
Tue, 21 Jun 2016 13:55:28 +0000 (23:55 +1000)
committernick_m <mainsbridge@gmail.com>
Sat, 9 Jul 2016 16:18:37 +0000 (02:18 +1000)
- fixes single-tempo assumption.

gtk2_ardour/editor_regions.cc

index fc946abe5da2b660d9553f2bec00eaad96d4a36a..111444ec8b8af97ab7d97dd0f12f661eb40f64cc 100644 (file)
@@ -852,7 +852,15 @@ void
 EditorRegions::populate_row_length (boost::shared_ptr<Region> region, TreeModel::Row const &row)
 {
        char buf[16];
-       format_position (region->length(), buf, sizeof (buf));
+
+       if (ARDOUR_UI::instance()->secondary_clock->mode () == AudioClock::BBT) {
+               TempoMap& map (_session->tempo_map());
+               Timecode::BBT_Time bbt = map.bbt_at_beat (map.beat_at_frame (region->last_frame()) - map.beat_at_frame (region->first_frame()));
+               snprintf (buf, sizeof (buf), "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
+       } else {
+               format_position (region->length(), buf, sizeof (buf));
+       }
+
        row[_columns.length] = buf;
 }