From f190493e32948a6d5a9624fffe82052e3ec8f641 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 25 Feb 2024 20:52:37 +0100 Subject: [PATCH] grid: display grid lines for triplets/quintuplets/septuplets --- gtk2_ardour/editor_tempodisplay.cc | 33 +++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 76593557e5..3b1af15b3e 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -358,25 +358,48 @@ Editor::compute_current_bbt_points (Temporal::TempoMapPoints& grid, samplepos_t const Beats lower_beat = (left < Beats() ? Beats() : left); const samplecnt_t sr (_session->sample_rate()); + int divisor; + switch (_grid_type) { + case GridTypeBeatDiv3: + case GridTypeBeatDiv6: + case GridTypeBeatDiv12: + case GridTypeBeatDiv24: + divisor = 3; + break; + case GridTypeBeatDiv5: + case GridTypeBeatDiv10: + case GridTypeBeatDiv20: + divisor = 5; + break; + case GridTypeBeatDiv7: + case GridTypeBeatDiv14: + case GridTypeBeatDiv28: + divisor = 7; + break; + default: + divisor = 2; + break; + }; + switch (bbt_ruler_scale) { case bbt_show_quarters: tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 1); break; case bbt_show_eighths: - tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 2); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 1 * divisor); break; case bbt_show_sixteenths: - tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 4); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 2 * divisor); break; case bbt_show_thirtyseconds: - tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 8); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 4 * divisor); break; case bbt_show_sixtyfourths: - tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 16); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 8 * divisor); break; case bbt_show_onetwentyeighths: - tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 32); + tmap->get_grid (grid, max (tmap->superclock_at (lower_beat), (superclock_t) 0), samples_to_superclock (rightmost, sr), 0, 16 * divisor); break; case bbt_show_1: