launching control app is now responsibility of ardour GUI, not audio backend; use ARDOUR_DEVICE_CONTROL_APP if set in the environment

This commit is contained in:
Paul Davis 2013-09-09 16:48:27 -04:00
parent f06187735d
commit ecfeeda4b8
4 changed files with 38 additions and 48 deletions

View file

@ -25,7 +25,7 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <glibmm.h> #include <glibmm/spawn.h>
#include <gtkmm/messagedialog.h> #include <gtkmm/messagedialog.h>
#include "pbd/error.h" #include "pbd/error.h"
@ -790,22 +790,46 @@ EngineControl::get_device_name () const
void void
EngineControl::control_app_button_clicked () EngineControl::control_app_button_clicked ()
{ {
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (!backend) { const string appname = g_getenv ("ARDOUR_DEVICE_CONTROL_APP");
if (appname.empty()) {
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (!backend) {
return;
}
string appname = backend->control_app_name();
}
if (appname.empty()) {
return; return;
} }
backend->launch_control_app(); std::list<string> args;
args.push_back (appname);
Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH);
} }
void void
EngineControl::manage_control_app_sensitivity () EngineControl::manage_control_app_sensitivity ()
{ {
boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend(); const string appname = g_getenv ("ARDOUR_DEVICE_CONTROL_APP");
if (backend && backend->have_control_app()) {
control_app_button.set_sensitive (true); if (appname.empty()) {
} else { boost::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance()->current_backend();
if (!backend) {
return;
}
string appname = backend->control_app_name();
}
if (appname.empty()) {
control_app_button.set_sensitive (false); control_app_button.set_sensitive (false);
} else {
control_app_button.set_sensitive (true);
} }
} }

View file

@ -228,20 +228,12 @@ class AudioBackend {
virtual uint32_t systemic_input_latency () const = 0; virtual uint32_t systemic_input_latency () const = 0;
virtual uint32_t systemic_output_latency () const = 0; virtual uint32_t systemic_output_latency () const = 0;
/** Return true if it is possible to launch a control app /** Return the name of a control application for the
* at this time. Return false otherwise. * selected/in-use device. If no such application exists,
* * or if no device has been selected or is in-use,
* The audio backend may not know the device for which the * return an empty string.
* control app should be opened, or there may no such
* application. In such cases, this method should return false.
*/ */
virtual bool have_control_app() const = 0; virtual std::string control_app_name() 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;
/* Basic state control */ /* Basic state control */

View file

@ -23,7 +23,6 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <glibmm/timer.h> #include <glibmm/timer.h>
#include <glibmm/spawn.h>
#include "pbd/error.h" #include "pbd/error.h"
@ -981,26 +980,3 @@ JACKAudioBackend::control_app_name () const
return appname; 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<string> args;
args.push_back (appname);
Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH);
}

View file

@ -84,8 +84,7 @@ class JACKAudioBackend : public AudioBackend {
uint32_t systemic_input_latency () const; uint32_t systemic_input_latency () const;
uint32_t systemic_output_latency () const; uint32_t systemic_output_latency () const;
bool have_control_app() const; std::string control_app_name () const;
void launch_control_app ();
int start (); int start ();
int stop (); int stop ();
@ -182,7 +181,6 @@ class JACKAudioBackend : public AudioBackend {
mutable DriverDeviceMap all_devices; mutable DriverDeviceMap all_devices;
PBD::ScopedConnection disconnect_connection; PBD::ScopedConnection disconnect_connection;
std::string control_app_name () const;
}; };
} // namespace } // namespace