X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui.cc;h=cc173c80e333649ddb51240089dfb33784ab2e36;hb=cad92bfa4e0a6c14068e3b42f0b7c3baf18aee8a;hp=1130177fe238ef9775e21daa52bfb90a653e5617;hpb=0938a42440cc82ce8d0cb064840c258c863714ab;p=ardour.git
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 1130177fe2..cc173c80e3 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -78,6 +78,7 @@
#include "ardour/midi_track.h"
#include "ardour/filesystem_paths.h"
#include "ardour/filename_extensions.h"
+#include "ardour/process_thread.h"
typedef uint64_t microseconds_t;
@@ -178,6 +179,8 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
, error_log_button (_("Errors"))
+ , _status_bar_visibility (X_("status-bar"))
+
{
using namespace Gtk::Menu_Helpers;
@@ -329,6 +332,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup));
stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown));
+
+ _process_thread = new ProcessThread ();
+ _process_thread->init ();
}
/** @return true if a session was chosen and `apply' clicked, otherwise false if `cancel' was clicked */
@@ -409,6 +415,12 @@ ARDOUR_UI::post_engine ()
throw failed_constructor ();
}
+ /* Do this after setup_windows (), as that's when the _status_bar_visibility is created */
+ XMLNode* n = Config->extra_xml (X_("UI"));
+ if (n) {
+ _status_bar_visibility.set_state (*n);
+ }
+
check_memory_locking();
/* this is the first point at which all the keybindings are available */
@@ -712,6 +724,11 @@ ARDOUR_UI::startup ()
add_window_proxy (_global_port_matrix[*i]);
}
+ /* We have to do this here since goto_editor_window() ends up calling show_all() on the
+ * editor window, and we may want stuff to be hidden.
+ */
+ _status_bar_visibility.update ();
+
BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME));
}
@@ -959,7 +976,7 @@ ARDOUR_UI::every_point_zero_one_seconds ()
void
ARDOUR_UI::update_sample_rate (framecnt_t)
{
- char buf[32];
+ char buf[64];
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::update_sample_rate, ignored)
@@ -972,17 +989,17 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
framecnt_t rate = engine->frame_rate();
if (fmod (rate, 1000.0) != 0.0) {
- snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f ms"),
+ snprintf (buf, sizeof (buf), _("JACK: %.1f kHz / %4.1f ms"),
(float) rate/1000.0f,
(engine->frames_per_cycle() / (float) rate) * 1000.0f);
} else {
- snprintf (buf, sizeof (buf), _("%" PRId64 " kHz / %4.1f ms"),
+ snprintf (buf, sizeof (buf), _("JACK: %" PRId64 " kHz / %4.1f ms"),
rate/1000,
(engine->frames_per_cycle() / (float) rate) * 1000.0f);
}
}
- sample_rate_label.set_text (buf);
+ sample_rate_label.set_markup (buf);
}
void
@@ -994,6 +1011,7 @@ ARDOUR_UI::update_format ()
}
stringstream s;
+ s << "File: ";
switch (_session->config.get_native_file_header_format ()) {
case BWF:
@@ -1033,26 +1051,49 @@ ARDOUR_UI::update_format ()
break;
}
- format_label.set_text (s.str ());
+ s << "";
+
+ format_label.set_markup (s.str ());
}
void
ARDOUR_UI::update_cpu_load ()
{
- char buf[32];
- snprintf (buf, sizeof (buf), _("DSP: %5.1f%%"), engine->get_cpu_load());
- cpu_load_label.set_text (buf);
+ char buf[64];
+
+ /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::build_menu_bar
+ should also be changed.
+ */
+
+ float const c = engine->get_cpu_load ();
+ snprintf (buf, sizeof (buf), _("DSP: %5.1f%%"), c >= 90 ? X_("red") : X_("green"), c);
+ cpu_load_label.set_markup (buf);
}
void
ARDOUR_UI::update_buffer_load ()
{
- char buf[64];
+ char buf[256];
+
+ uint32_t const playback = _session ? _session->playback_load () : 100;
+ uint32_t const capture = _session ? _session->capture_load () : 100;
+ /* If this text is changed, the set_size_request_to_display_given_text call in ARDOUR_UI::build_menu_bar
+ should also be changed.
+ */
+
if (_session) {
- snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"),
- _session->playback_load(), _session->capture_load());
- buffer_load_label.set_text (buf);
+ snprintf (
+ buf, sizeof (buf),
+ _("Buffers: p:%" PRIu32 "%% "
+ "c:%" PRIu32 "%%"),
+ playback <= 5 ? X_("red") : X_("green"),
+ playback,
+ capture <= 5 ? X_("red") : X_("green"),
+ capture
+ );
+
+ buffer_load_label.set_markup (buf);
} else {
buffer_load_label.set_text ("");
}
@@ -1079,7 +1120,7 @@ ARDOUR_UI::update_disk_space()
framecnt_t fr = _session->frame_rate();
if (frames == max_framecnt) {
- strcpy (buf, _("Disk: 24hrs+"));
+ snprintf (buf, sizeof (buf), _("Disk: 24hrs+"));
} else {
rec_enabled_streams = 0;
_session->foreach_route (this, &ARDOUR_UI::count_recenabled_streams);
@@ -1098,10 +1139,17 @@ ARDOUR_UI::update_disk_space()
frames -= mins * fr * 60;
secs = frames / fr;
- snprintf (buf, sizeof(buf), _("Disk: %02dh:%02dm:%02ds"), hrs, mins, secs);
+ bool const low = (hrs == 0 && mins <= 30);
+
+ snprintf (
+ buf, sizeof(buf),
+ _("Disk: %02dh:%02dm:%02ds"),
+ low ? X_("red") : X_("green"),
+ hrs, mins, secs
+ );
}
- disk_space_label.set_text (buf);
+ disk_space_label.set_markup (buf);
// An attempt to make the disk space label flash red when space has run out.
@@ -2129,7 +2177,7 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
time (&n);
localtime_r (&n, &local_time);
- strftime (timebuf, sizeof(timebuf), "%FT%T", &local_time);
+ strftime (timebuf, sizeof(timebuf), "%FT%H.%M.%S", &local_time);
prompter.set_initial_text (timebuf);
}
@@ -2154,6 +2202,12 @@ ARDOUR_UI::snapshot_session (bool switch_to_it)
msg.run ();
goto again;
}
+ if (snapname.find (':') != string::npos) {
+ MessageDialog msg (_("To ensure compatibility with various systems\n"
+ "snapshot names may not contain a ':' character"));
+ msg.run ();
+ goto again;
+ }
}
vector p;
@@ -3695,12 +3749,6 @@ ARDOUR_UI::TransportControllable::get_value (void) const
return val;
}
-void
-ARDOUR_UI::TransportControllable::set_id (const string& str)
-{
- _id = str;
-}
-
void
ARDOUR_UI::setup_profile ()
{
@@ -3806,3 +3854,17 @@ ARDOUR_UI::ambiguous_file (std::string file, std::string /*path*/, std::vectorget_buffers ();
+}
+
+/** Drop our thread-local buffers */
+void
+ARDOUR_UI::drop_process_buffers ()
+{
+ _process_thread->drop_buffers ();
+}