From cff174b5417d9b242673588792d390db9f61ca93 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 23 Sep 2013 21:35:17 -0400 Subject: [PATCH] move rate_as_string() from EngineControl to utils.cc --- gtk2_ardour/engine_dialog.cc | 13 +------------ gtk2_ardour/engine_dialog.h | 1 - gtk2_ardour/utils.cc | 13 +++++++++++++ gtk2_ardour/utils.h | 2 ++ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 79bda1bcc5..a63e310b3f 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -48,6 +48,7 @@ #include "ardour_ui.h" #include "engine_dialog.h" #include "gui_thread.h" +#include "utils.h" #include "i18n.h" using namespace std; @@ -800,18 +801,6 @@ EngineControl::device_changed () push_state_to_backend (false); } -string -EngineControl::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; -} - string EngineControl::bufsize_as_string (uint32_t sz) { diff --git a/gtk2_ardour/engine_dialog.h b/gtk2_ardour/engine_dialog.h index 59924e0f0a..ac17814a5f 100644 --- a/gtk2_ardour/engine_dialog.h +++ b/gtk2_ardour/engine_dialog.h @@ -122,7 +122,6 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList { void setup_midi_tab_for_jack (); void refresh_midi_display (); - std::string rate_as_string (float); std::string bufsize_as_string (uint32_t); float get_rate() const; diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c81aff85ab..a0fd7016b5 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -860,3 +861,15 @@ unique_random_color (list& 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; +} diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h index 5d7bf000ea..a1a54898b5 100644 --- a/gtk2_ardour/utils.h +++ b/gtk2_ardour/utils.h @@ -86,4 +86,6 @@ std::string escape_angled_brackets (std::string const &); Gdk::Color unique_random_color (std::list &); +std::string rate_as_string (float r); + #endif /* __ardour_gtk_utils_h__ */