summaryrefslogtreecommitdiff
path: root/gtk2_ardour/latency_gui.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-05-20 13:28:30 +0000
committerCarl Hetherington <carl@carlh.net>2009-05-20 13:28:30 +0000
commit64524c0ba40b9f69f06a395f8763615700244fda (patch)
tree35178c663851a00069c6f3c3a7fbe4ee99f17d5d /gtk2_ardour/latency_gui.cc
parentdbe20bd3a9d23e1e49556a1f47a31c5b8144dfda (diff)
Make pan double-click entry work in percentage left or right. Write pan position to the panner as text (except when centered). Use a virtual function rather than a signal for BarController labels.
git-svn-id: svn://localhost/ardour2/branches/3.0@5104 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/latency_gui.cc')
-rw-r--r--gtk2_ardour/latency_gui.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/gtk2_ardour/latency_gui.cc b/gtk2_ardour/latency_gui.cc
index 1f3ae38da4..3b4e3b4222 100644
--- a/gtk2_ardour/latency_gui.cc
+++ b/gtk2_ardour/latency_gui.cc
@@ -1,6 +1,7 @@
#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
+#include <iomanip>
#include "ardour/latent.h"
#include <gtkmm2ext/utils.h>
@@ -24,16 +25,19 @@ static const gchar *_unit_strings[] = {
std::vector<std::string> LatencyGUI::unit_strings;
-void
-LatencyGUI::latency_printer (char *buf, unsigned int bufsize)
+std::string
+LatencyGUI::get_label (int&)
{
- double nframes = adjustment.get_value();
+ double const nframes = adjustment.get_value();
+ std::stringstream s;
if (nframes < (sample_rate / 1000.0)) {
- snprintf (buf, bufsize, "%" PRId64 " samples", (nframes64_t) rint (nframes));
+ s << ((nframes64_t) rint (nframes)) << " samples";
} else {
- snprintf (buf, bufsize, "%.2g msecs" , nframes / (sample_rate / 1000.0));
+ s << std::fixed << std::setprecision (2) << (nframes / (sample_rate / 1000.0)) << " msecs";
}
+
+ return s.str ();
}
LatencyGUI::LatencyGUI (Latent& l, nframes64_t sr, nframes64_t psz)
@@ -44,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, sigc::mem_fun (*this, &LatencyGUI::latency_printer)),
+ bc (adjustment, ignored),
reset_button (_("Reset"))
{
Widget* w;