a reverb is a reverb is a reverb
[ardour.git] / gtk2_ardour / tempo_lines.cc
index ef4cba39214b8db7dc9e55274a0feb78163d0006..630e476adf82c263d68baae20a19c80edb16890d 100644 (file)
@@ -59,7 +59,6 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
                         framecnt_t                                            leftmost_frame,
                         framecnt_t                                            frame_rate)
 {
-       const double   fpb  = grid.begin()->tempo.frames_per_beat(frame_rate);
        const uint32_t base = UIConfiguration::instance().color_mod("measure line beat", "measure line beat");
 
        for (unsigned l = 1; l < divisions; ++l) {
@@ -70,21 +69,23 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
                                level = d;
                        }
                }
-
                /* 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);
                framepos_t f = 0;
 
                if (grid.begin()->c != 0.0) {
-                       const double pulses_per_div = l * (grid.begin()->tempo.note_type() / grid.begin()->meter->note_divisor()) / divisions;
-                       const double time_at_pulse = log (((grid.begin()->c * (pulses_per_div / grid.begin()->tempo.note_type())) /
-                                                          grid.begin()->tempo.pulses_per_minute()) + 1) / grid.begin()->c;
-                       f = grid.begin()->frame + (framecnt_t) floor ((time_at_pulse * 60.0 * frame_rate) + 0.5);
+                       const double beat_divisions = (l / ((double) divisions)) * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor());
+                       const double time_at_division = log (((grid.begin()->c * (beat_divisions)) /
+                                                          grid.begin()->tempo.beats_per_minute()) + 1) / grid.begin()->c;
+
+                       f = grid.begin()->frame + (framecnt_t) floor ((time_at_division * 60.0 * frame_rate) + 0.5);
                } else {
-                       f = grid.begin()->frame + (l * (fpb / (double)divisions));
-               }
+                       const double fpb  = grid.begin()->tempo.frames_per_beat (frame_rate)
+                               * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor());
 
+                       f = grid.begin()->frame + (l * (fpb / (double) divisions));
+               }
                if (f > leftmost_frame) {
                        lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c);
                }
@@ -151,8 +152,7 @@ TempoLines::draw (std::vector<ARDOUR::TempoMap::BBTPoint>& grid,
                        /* draw subdivisions of this beat */
                        std::vector<ARDOUR::TempoMap::BBTPoint> vec;
                        vec.push_back (*i);
-
-                       draw_ticks(vec, divisions, leftmost_frame, frame_rate);
+                       draw_ticks (vec, divisions, leftmost_frame, frame_rate);
                }
        }
 }