summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-08-08 16:31:08 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-08-08 16:31:08 -0400
commitd90e2b42211ead2a38afd5590e2937992312795e (patch)
tree6abc6aa6571c1206a822e3ef4036458791cbaeaf /gtk2_ardour
parentea7d89dd519caa7a45ad7a0e99bad14445513f3b (diff)
rationalize (a bit) engine start/stop/restart so that it is possible to start up, disconnect from JACK and then reconnect
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/ardour_ui.cc226
-rw-r--r--gtk2_ardour/ardour_ui.h1
-rwxr-xr-xgtk2_ardour/arval1
3 files changed, 117 insertions, 111 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index ba53468414..00767b7988 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -161,6 +161,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, nsm (0)
, _was_dirty (false)
, _mixer_on_top (false)
+ , first_time_engine_run (true)
/* transport */
@@ -415,9 +416,121 @@ ARDOUR_UI::attach_to_engine ()
}
void
+ARDOUR_UI::engine_stopped ()
+{
+ ENSURE_GUI_THREAD (*this, &ARDOUR_UI::engine_stopped)
+ ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false);
+ ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true);
+}
+
+void
+ARDOUR_UI::engine_running ()
+{
+ if (first_time_engine_run) {
+ post_engine();
+ first_time_engine_run = false;
+ }
+
+ ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, true);
+ ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, false);
+
+ Glib::RefPtr<Action> action;
+ const char* action_name = 0;
+
+ switch (engine->samples_per_cycle()) {
+ case 32:
+ action_name = X_("JACKLatency32");
+ break;
+ case 64:
+ action_name = X_("JACKLatency64");
+ break;
+ case 128:
+ action_name = X_("JACKLatency128");
+ break;
+ case 512:
+ action_name = X_("JACKLatency512");
+ break;
+ case 1024:
+ action_name = X_("JACKLatency1024");
+ break;
+ case 2048:
+ action_name = X_("JACKLatency2048");
+ break;
+ case 4096:
+ action_name = X_("JACKLatency4096");
+ break;
+ case 8192:
+ action_name = X_("JACKLatency8192");
+ break;
+ default:
+ /* XXX can we do anything useful ? */
+ break;
+ }
+
+ if (action_name) {
+
+ action = ActionManager::get_action (X_("JACK"), action_name);
+
+ if (action) {
+ Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action);
+ ract->set_active ();
+ }
+
+ update_disk_space ();
+ update_cpu_load ();
+ update_sample_rate (engine->sample_rate());
+ update_timecode_format ();
+ }
+}
+
+void
+ARDOUR_UI::engine_halted (const char* reason, bool free_reason)
+{
+ if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
+ /* we can't rely on the original string continuing to exist when we are called
+ again in the GUI thread, so make a copy and note that we need to
+ free it later.
+ */
+ char *copy = strdup (reason);
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&ARDOUR_UI::engine_halted, this, copy, true));
+ return;
+ }
+
+ ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false);
+ ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true);
+
+ update_sample_rate (0);
+
+ string msgstr;
+
+ /* if the reason is a non-empty string, it means that the backend was shutdown
+ rather than just Ardour.
+ */
+
+ if (strlen (reason)) {
+ msgstr = string_compose (_("The audio backend (JACK) was shutdown because:\n\n%1"), reason);
+ } else {
+ msgstr = string_compose (_("\
+JACK has either been shutdown or it\n\
+disconnected %1 because %1\n\
+was not fast enough. Try to restart\n\
+JACK, reconnect and save the session."), PROGRAM_NAME);
+ }
+
+ MessageDialog msg (*editor, msgstr);
+ pop_back_splash (msg);
+ msg.set_keep_above (true);
+ msg.run ();
+
+ if (free_reason) {
+ free (const_cast<char*> (reason));
+ }
+}
+
+void
ARDOUR_UI::post_engine ()
{
- /* Things to be done once we have a backend running in the AudioEngine
+ /* Things to be done once (and once ONLY) after we have a backend running in the AudioEngine
*/
ARDOUR::init_post_engine ();
@@ -483,11 +596,6 @@ ARDOUR_UI::post_engine ()
Glib::signal_timeout().connect_seconds (sigc::mem_fun(*this, &ARDOUR_UI::update_wall_clock), 1);
#endif
- update_disk_space ();
- update_cpu_load ();
- update_sample_rate (engine->sample_rate());
- update_timecode_format ();
-
Config->ParameterChanged.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::parameter_changed, this, _1), gui_context());
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
Config->map_parameters (pc);
@@ -1042,7 +1150,7 @@ ARDOUR_UI::update_sample_rate (framecnt_t)
if (!engine->connected()) {
- snprintf (buf, sizeof (buf), "%s", _("disconnected"));
+ snprintf (buf, sizeof (buf), _("Audio: <span foreground=\"red\">none</span>"));
} else {
@@ -2042,110 +2150,6 @@ ARDOUR_UI::map_transport_state ()
}
void
-ARDOUR_UI::engine_stopped ()
-{
- ENSURE_GUI_THREAD (*this, &ARDOUR_UI::engine_stopped)
- ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false);
- ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true);
-}
-
-void
-ARDOUR_UI::engine_running ()
-{
- post_engine();
-
- ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, true);
- ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, false);
-
- Glib::RefPtr<Action> action;
- const char* action_name = 0;
-
- switch (engine->samples_per_cycle()) {
- case 32:
- action_name = X_("JACKLatency32");
- break;
- case 64:
- action_name = X_("JACKLatency64");
- break;
- case 128:
- action_name = X_("JACKLatency128");
- break;
- case 512:
- action_name = X_("JACKLatency512");
- break;
- case 1024:
- action_name = X_("JACKLatency1024");
- break;
- case 2048:
- action_name = X_("JACKLatency2048");
- break;
- case 4096:
- action_name = X_("JACKLatency4096");
- break;
- case 8192:
- action_name = X_("JACKLatency8192");
- break;
- default:
- /* XXX can we do anything useful ? */
- break;
- }
-
- if (action_name) {
-
- action = ActionManager::get_action (X_("JACK"), action_name);
-
- if (action) {
- Glib::RefPtr<RadioAction> ract = Glib::RefPtr<RadioAction>::cast_dynamic (action);
- ract->set_active ();
- }
- }
-}
-
-void
-ARDOUR_UI::engine_halted (const char* reason, bool free_reason)
-{
- if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
- /* we can't rely on the original string continuing to exist when we are called
- again in the GUI thread, so make a copy and note that we need to
- free it later.
- */
- char *copy = strdup (reason);
- Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&ARDOUR_UI::engine_halted, this, copy, true));
- return;
- }
-
- ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false);
- ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true);
-
- update_sample_rate (0);
-
- string msgstr;
-
- /* if the reason is a non-empty string, it means that the backend was shutdown
- rather than just Ardour.
- */
-
- if (strlen (reason)) {
- msgstr = string_compose (_("The audio backend (JACK) was shutdown because:\n\n%1"), reason);
- } else {
- msgstr = string_compose (_("\
-JACK has either been shutdown or it\n\
-disconnected %1 because %1\n\
-was not fast enough. Try to restart\n\
-JACK, reconnect and save the session."), PROGRAM_NAME);
- }
-
- MessageDialog msg (*editor, msgstr);
- pop_back_splash (msg);
- msg.set_keep_above (true);
- msg.run ();
-
- if (free_reason) {
- free (const_cast<char*> (reason));
- }
-}
-
-void
ARDOUR_UI::update_clocks ()
{
if (!editor || !editor->dragging_playhead()) {
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index 1dcaeb0e9e..e784b5a994 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -315,6 +315,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
NSM_Client *nsm;
bool _was_dirty;
bool _mixer_on_top;
+ bool first_time_engine_run;
void goto_editor_window ();
void goto_mixer_window ();
diff --git a/gtk2_ardour/arval b/gtk2_ardour/arval
index 6503bc1ede..2209dcb110 100755
--- a/gtk2_ardour/arval
+++ b/gtk2_ardour/arval
@@ -10,5 +10,6 @@ LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export ARDOUR_RUNNING_UNDER_VALGRIND=TRUE
exec valgrind --tool=memcheck \
$VALGRIND_OPTIONS \
+ --track-origins=yes \
--suppressions=`dirname "$0"`/../tools/valgrind.supp \
$TOP/$EXECUTABLE --novst "$@"