Fix incorrect positioning of tempo line subdivisions if first meter is non-zero
authornick_m <mainsbridge@gmail.com>
Fri, 9 Jun 2017 01:05:56 +0000 (11:05 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 9 Jun 2017 01:05:56 +0000 (11:05 +1000)
Commit cebefe6 assumed that frame 0 was the music origin.
Silly me.

gtk2_ardour/editor.cc
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/tempo_lines.cc
gtk2_ardour/tempo_lines.h

index 0350de1d12685a1b55000dc51355f74c04463710..6ff757c1b79aaddb9734a4b788132f670c761ccf 100644 (file)
@@ -4518,7 +4518,7 @@ Editor::set_samples_per_pixel (framecnt_t spp)
        samples_per_pixel = spp;
 
        if (tempo_lines) {
-               tempo_lines->tempo_map_changed();
+               tempo_lines->tempo_map_changed(_session->tempo_map().music_origin());
        }
 
        bool const showing_time_selection = selection->time.length() > 0;
index b11bee44d3921acff36a7257589b40bf880c8aee..34a80dfc9371dea42a22008b94e0f44b929a6ede 100644 (file)
@@ -181,7 +181,7 @@ Editor::tempo_map_changed (const PropertyChange& /*ignored*/)
        ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed, ignored);
 
        if (tempo_lines) {
-               tempo_lines->tempo_map_changed();
+               tempo_lines->tempo_map_changed(_session->tempo_map().music_origin());
        }
 
        compute_bbt_ruler_scale (leftmost_frame, leftmost_frame + current_page_samples());
@@ -204,7 +204,7 @@ Editor::tempometric_position_changed (const PropertyChange& /*ignored*/)
        ENSURE_GUI_THREAD (*this, &Editor::tempo_map_changed);
 
        if (tempo_lines) {
-               tempo_lines->tempo_map_changed();
+               tempo_lines->tempo_map_changed(_session->tempo_map().music_origin());
        }
 
        TempoSection* prev_ts = 0;
@@ -394,7 +394,7 @@ Editor::draw_measures (std::vector<ARDOUR::TempoMap::BBTPoint>& grid)
        }
 
        if (tempo_lines == 0) {
-               tempo_lines = new TempoLines (time_line_group, ArdourCanvas::LineSet::Vertical, new BeatsFramesConverter (_session->tempo_map(), 0));
+               tempo_lines = new TempoLines (time_line_group, ArdourCanvas::LineSet::Vertical, new BeatsFramesConverter (_session->tempo_map(), _session->tempo_map().music_origin()));
        }
 
        const unsigned divisions = get_grid_beat_divisions(leftmost_frame);
index cdbde54961a4e73ff88c272951281566712d6753..8d1d183d3a8a6be6d9b2d33052da97b0e76f360d 100644 (file)
@@ -43,9 +43,10 @@ TempoLines::~TempoLines ()
 }
 
 void
-TempoLines::tempo_map_changed()
+TempoLines::tempo_map_changed (framepos_t new_origin)
 {
        lines.clear ();
+       _bfc->set_origin_b (new_origin);
 }
 
 void
@@ -79,7 +80,7 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
                /* draw line with alpha corresponding to coarsest level */
                const uint8_t    a = max(8, (int)rint(UINT_RGBA_A(base) / (0.8 * log2(level))));
                const uint32_t   c = UINT_RGBA_CHANGE_A(base, a);
-               const framepos_t f = _bfc->to (Evoral::Beats (grid.begin()->qn + (l / (double) divisions)));
+               const framepos_t f = _bfc->to (Evoral::Beats (grid.begin()->qn + (l / (double) divisions))) + _bfc->origin_b();
 
                if (f > leftmost_frame) {
                        lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c);
index be5e1315c99c4da3eac6c7dcfde568772ecd8998..158ef7b1f96504f6ed4b0e9494de8815efb5c71d 100644 (file)
@@ -29,7 +29,7 @@ public:
        TempoLines (ArdourCanvas::Container* group, double screen_height, ARDOUR::BeatsFramesConverter* bfc);
        ~TempoLines ();
 
-       void tempo_map_changed();
+       void tempo_map_changed(framepos_t new_origin);
 
        void draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
                   unsigned                                              divisions,