diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc index 3b4e3b4222..08c59dc64d 100644 --- a/gtk2_ardour/latency_gui.cc +++ b/gtk2_ardour/latency_gui.cc @@ -26,15 +26,15 @@ static const gchar *_unit_strings[] = { std::vector LatencyGUI::unit_strings; std::string -LatencyGUI::get_label (int&) +LatencyBarController::get_label (int&) { - double const nframes = adjustment.get_value(); + double const nframes = _latency_gui->adjustment.get_value(); std::stringstream s; - if (nframes < (sample_rate / 1000.0)) { + if (nframes < (_latency_gui->sample_rate / 1000.0)) { s << ((nframes64_t) rint (nframes)) << " samples"; } else { - s << std::fixed << std::setprecision (2) << (nframes / (sample_rate / 1000.0)) << " msecs"; + s << std::fixed << std::setprecision (2) << (nframes / (_latency_gui->sample_rate / 1000.0)) << " msecs"; } return s.str (); @@ -48,7 +48,7 @@ LatencyGUI::LatencyGUI (Latent& l, nframes64_t sr, nframes64_t psz) ignored (new PBD::IgnorableControllable()), /* max 1 second, step by frames, page by msecs */ adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f), - bc (adjustment, ignored), + bc (adjustment, this), reset_button (_("Reset")) { Widget* w; diff --git a/gtk2_ardour/latency_gui.h b/gtk2_ardour/latency_gui.h index 35fad9e296..9d36103ed7 100644 --- a/gtk2_ardour/latency_gui.h +++ b/gtk2_ardour/latency_gui.h @@ -20,6 +20,21 @@ namespace ARDOUR { class Latent; } +class LatencyGUI; + +class LatencyBarController : public Gtkmm2ext::BarController +{ +public: + LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g) + : BarController (adj, boost::shared_ptr (new PBD::IgnorableControllable ())), + _latency_gui (g) {} + +private: + LatencyGUI* _latency_gui; + + std::string get_label (int&); +}; + class LatencyGUI : public Gtk::VBox { public: @@ -31,8 +46,6 @@ class LatencyGUI : public Gtk::VBox void refresh (); private: - std::string get_label (int&); - ARDOUR::Latent& _latent; nframes64_t initial_value; nframes64_t sample_rate; @@ -40,7 +53,7 @@ class LatencyGUI : public Gtk::VBox boost::shared_ptr ignored; Gtk::Adjustment adjustment; - Gtkmm2ext::BarController bc; + LatencyBarController bc; Gtk::HBox hbox1; Gtk::HBox hbox2; Gtk::HButtonBox hbbox; @@ -51,6 +64,8 @@ class LatencyGUI : public Gtk::VBox void change_latency_from_button (int dir); + friend class LatencyBarController; + static std::vector unit_strings; }; diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc index 1ba3449cb8..34514d9040 100644 --- a/gtk2_ardour/route_ui.cc +++ b/gtk2_ardour/route_ui.cc @@ -1329,7 +1329,7 @@ RouteUI::map_frozen () void RouteUI::adjust_latency () { - LatencyDialog dialog (_route->name() + _("latency"), *(_route->output()), _session.frame_rate(), _session.engine().frames_per_cycle()); + LatencyDialog dialog (_route->name() + _(" latency"), *(_route->output()), _session.frame_rate(), _session.engine().frames_per_cycle()); } void