diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-16 22:06:56 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-10-16 22:06:56 -0400 |
commit | e5888d398350b26ba2cdc634cc9791e90b4fc6b6 (patch) | |
tree | 54f485ea56d034ecba01938fbc680b12884fc136 /gtk2_ardour/utils.cc | |
parent | 18850253e9f0034fad132e0da07a2651ce041450 (diff) | |
parent | da5a49067839ec32a016bf1b66c3808ad7cbf699 (diff) |
merge with master and fix 2 conflicts
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r-- | gtk2_ardour/utils.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 913d962831..e6dc2c5790 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -28,6 +28,7 @@ #include <clocale> #include <cstring> #include <cctype> +#include <cmath> #include <fstream> #include <list> #include <sys/stat.h> @@ -841,3 +842,15 @@ unique_random_color (list<Gdk::Color>& used_colors) /* XXX need throttle here to make sure we don't spin for ever */ } } + +string +rate_as_string (float r) +{ + char buf[32]; + if (fmod (r, 1000.0f)) { + snprintf (buf, sizeof (buf), "%.1f kHz", r/1000.0); + } else { + snprintf (buf, sizeof (buf), "%.0f kHz", r/1000.0); + } + return buf; +} |