diff options
author | Robin Gareus <robin@gareus.org> | 2019-09-29 02:43:06 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-09-29 02:45:30 +0200 |
commit | 24aa61f08c28bc9ad65043a3c253d7dcac10eda3 (patch) | |
tree | 2372d5e5428f1ee0641285886c40521b0fb2a773 /gtk2_ardour/latency_gui.cc | |
parent | b3a20c762634517ad1160208fcc06ed1e3a4b2b4 (diff) |
Use samples_as_time_string API
Diffstat (limited to 'gtk2_ardour/latency_gui.cc')
-rw-r--r-- | gtk2_ardour/latency_gui.cc | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc index acfa376892..c417edd5a9 100644 --- a/gtk2_ardour/latency_gui.cc +++ b/gtk2_ardour/latency_gui.cc @@ -33,6 +33,7 @@ #include "gtkmm2ext/utils.h" #include "latency_gui.h" +#include "utils.h" #include "pbd/i18n.h" @@ -54,17 +55,8 @@ std::vector<std::string> LatencyGUI::unit_strings; std::string LatencyBarController::get_label (double&) { - double const nframes = _latency_gui->adjustment.get_value(); - std::stringstream s; - - if (nframes < (_latency_gui->sample_rate / 1000.0)) { - const samplepos_t nf = (samplepos_t) rint (nframes); - s << string_compose (P_("%1 sample", "%1 samples", nf), nf); - } else { - s << std::fixed << std::setprecision (2) << (nframes / (_latency_gui->sample_rate / 1000.0)) << " ms"; - } - - return s.str (); + return ARDOUR_UI_UTILS::samples_as_time_string ( + _latency_gui->adjustment.get_value(), _latency_gui->sample_rate, true); } LatencyGUI::LatencyGUI (Latent& l, samplepos_t sr, samplepos_t psz) |