diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index b5a59af642..989f2802c3 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -25,7 +25,7 @@ #include -#include +#include #include #include "pbd/error.h" @@ -790,22 +790,46 @@ EngineControl::get_device_name () const void EngineControl::control_app_button_clicked () { - boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); - if (!backend) { + const string appname = g_getenv ("ARDOUR_DEVICE_CONTROL_APP"); + + if (appname.empty()) { + boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); + + if (!backend) { + return; + } + + string appname = backend->control_app_name(); + } + + if (appname.empty()) { return; } - backend->launch_control_app(); + std::list args; + args.push_back (appname); + Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH); } void EngineControl::manage_control_app_sensitivity () { - boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); - if (backend && backend->have_control_app()) { - control_app_button.set_sensitive (true); - } else { + const string appname = g_getenv ("ARDOUR_DEVICE_CONTROL_APP"); + + if (appname.empty()) { + boost::shared_ptr backend = ARDOUR::AudioEngine::instance()->current_backend(); + + if (!backend) { + return; + } + + string appname = backend->control_app_name(); + } + + if (appname.empty()) { control_app_button.set_sensitive (false); + } else { + control_app_button.set_sensitive (true); } } diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h index f598f1a93a..b8a1818e24 100644 --- a/libs/ardour/ardour/audio_backend.h +++ b/libs/ardour/ardour/audio_backend.h @@ -228,20 +228,12 @@ class AudioBackend { virtual uint32_t systemic_input_latency () const = 0; virtual uint32_t systemic_output_latency () const = 0; - /** Return true if it is possible to launch a control app - * at this time. Return false otherwise. - * - * The audio backend may not know the device for which the - * control app should be opened, or there may no such - * application. In such cases, this method should return false. + /** Return the name of a control application for the + * selected/in-use device. If no such application exists, + * or if no device has been selected or is in-use, + * return an empty string. */ - virtual bool have_control_app() const = 0; - - /** If the device name has been set, launch an application (if any exist) - * to manage the hardware settings of that device. If no such application - * exists, do nothing. - */ - virtual void launch_control_app () = 0; + virtual std::string control_app_name() const = 0; /* Basic state control */ diff --git a/libs/backends/jack/jack_audiobackend.cc b/libs/backends/jack/jack_audiobackend.cc index f21440e046..811e190fb6 100644 --- a/libs/backends/jack/jack_audiobackend.cc +++ b/libs/backends/jack/jack_audiobackend.cc @@ -23,7 +23,6 @@ #include #include -#include #include "pbd/error.h" @@ -981,26 +980,3 @@ JACKAudioBackend::control_app_name () const return appname; } -bool -JACKAudioBackend::have_control_app () const -{ - return !control_app_name().empty(); -} - -void -JACKAudioBackend::launch_control_app () -{ - /* launch control app, don't care if it succeeds */ - - string appname = control_app_name (); - - if (appname.empty()) { - return; - } - - std::list args; - args.push_back (appname); - Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH); -} - - diff --git a/libs/backends/jack/jack_audiobackend.h b/libs/backends/jack/jack_audiobackend.h index 15246a0305..969a28a77a 100644 --- a/libs/backends/jack/jack_audiobackend.h +++ b/libs/backends/jack/jack_audiobackend.h @@ -84,8 +84,7 @@ class JACKAudioBackend : public AudioBackend { uint32_t systemic_input_latency () const; uint32_t systemic_output_latency () const; - bool have_control_app() const; - void launch_control_app (); + std::string control_app_name () const; int start (); int stop (); @@ -182,7 +181,6 @@ class JACKAudioBackend : public AudioBackend { mutable DriverDeviceMap all_devices; PBD::ScopedConnection disconnect_connection; - std::string control_app_name () const; }; } // namespace