diff options
author | John Emmas <johne53@tiscali.co.uk> | 2013-10-06 11:56:03 +0100 |
---|---|---|
committer | John Emmas <johne53@tiscali.co.uk> | 2013-10-06 11:56:03 +0100 |
commit | 300b484cf6ac14c15e365c4062345d64a61c4b18 (patch) | |
tree | f10b9abedc141192f5c35f9c0f40e94f1d52786d /gtk2_ardour/utils.cc | |
parent | 7d78172abfd9b02bcb6809db3f7545e90dbe968d (diff) | |
parent | 2d5e605bf124c82f77a5a893e540bc176164947d (diff) |
Merge branch 'master' into windows+cc
Conflicts (hopefully resolved):
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_options.cc
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 eb370be0dc..00e94b0dd9 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> @@ -843,3 +844,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; +} |