13
0

Some small fixes to the latency GUI.

git-svn-id: svn://localhost/ardour2/branches/3.0@5243 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-06-22 02:00:25 +00:00
parent 167929c25a
commit 92f3bc5c44
3 changed files with 24 additions and 9 deletions

View File

@ -26,15 +26,15 @@ static const gchar *_unit_strings[] = {
std::vector<std::string> LatencyGUI::unit_strings; std::vector<std::string> LatencyGUI::unit_strings;
std::string 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; std::stringstream s;
if (nframes < (sample_rate / 1000.0)) { if (nframes < (_latency_gui->sample_rate / 1000.0)) {
s << ((nframes64_t) rint (nframes)) << " samples"; s << ((nframes64_t) rint (nframes)) << " samples";
} else { } 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 (); return s.str ();
@ -48,7 +48,7 @@ LatencyGUI::LatencyGUI (Latent& l, nframes64_t sr, nframes64_t psz)
ignored (new PBD::IgnorableControllable()), ignored (new PBD::IgnorableControllable()),
/* max 1 second, step by frames, page by msecs */ /* max 1 second, step by frames, page by msecs */
adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f), adjustment (initial_value, 0.0, sample_rate, 1.0, sample_rate / 1000.0f),
bc (adjustment, ignored), bc (adjustment, this),
reset_button (_("Reset")) reset_button (_("Reset"))
{ {
Widget* w; Widget* w;

View File

@ -20,6 +20,21 @@ namespace ARDOUR {
class Latent; class Latent;
} }
class LatencyGUI;
class LatencyBarController : public Gtkmm2ext::BarController
{
public:
LatencyBarController (Gtk::Adjustment& adj, LatencyGUI* g)
: BarController (adj, boost::shared_ptr<PBD::IgnorableControllable> (new PBD::IgnorableControllable ())),
_latency_gui (g) {}
private:
LatencyGUI* _latency_gui;
std::string get_label (int&);
};
class LatencyGUI : public Gtk::VBox class LatencyGUI : public Gtk::VBox
{ {
public: public:
@ -31,8 +46,6 @@ class LatencyGUI : public Gtk::VBox
void refresh (); void refresh ();
private: private:
std::string get_label (int&);
ARDOUR::Latent& _latent; ARDOUR::Latent& _latent;
nframes64_t initial_value; nframes64_t initial_value;
nframes64_t sample_rate; nframes64_t sample_rate;
@ -40,7 +53,7 @@ class LatencyGUI : public Gtk::VBox
boost::shared_ptr<PBD::IgnorableControllable> ignored; boost::shared_ptr<PBD::IgnorableControllable> ignored;
Gtk::Adjustment adjustment; Gtk::Adjustment adjustment;
Gtkmm2ext::BarController bc; LatencyBarController bc;
Gtk::HBox hbox1; Gtk::HBox hbox1;
Gtk::HBox hbox2; Gtk::HBox hbox2;
Gtk::HButtonBox hbbox; Gtk::HButtonBox hbbox;
@ -51,6 +64,8 @@ class LatencyGUI : public Gtk::VBox
void change_latency_from_button (int dir); void change_latency_from_button (int dir);
friend class LatencyBarController;
static std::vector<std::string> unit_strings; static std::vector<std::string> unit_strings;
}; };

View File

@ -1329,7 +1329,7 @@ RouteUI::map_frozen ()
void void
RouteUI::adjust_latency () 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 void