13
0

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 <glibmm.h>
#include <glibmm/spawn.h>
#include <gtkmm/messagedialog.h>
#include "pbd/error.h"
@ -790,22 +790,46 @@ EngineControl::get_device_name () const
void
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;
}
backend->launch_control_app();
std::list<string> args;
args.push_back (appname);
Glib::spawn_async ("", args, Glib::SPAWN_SEARCH_PATH);
}
void
EngineControl::manage_control_app_sensitivity ()
{
boost::shared_ptr<ARDOUR::AudioBackend> 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<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);
} 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_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 */

View File

@ -23,7 +23,6 @@
#include <boost/scoped_ptr.hpp>
#include <glibmm/timer.h>
#include <glibmm/spawn.h>
#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<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_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