Launch pavucontrol as PA's control app

This commit is contained in:
Robin Gareus 2019-07-26 04:43:56 +02:00
parent 7cf68eaf72
commit b759fb883e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 29 additions and 2 deletions

View File

@ -22,11 +22,14 @@
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <glibmm.h>
#include "pbd/compose.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
#include "pbd/pthread_utils.h"
#include "ardour/port_manager.h"
@ -521,6 +524,30 @@ PulseAudioBackend::midi_option () const
return get_standard_device_name (DeviceNone);
}
/* External control app */
std::string
PulseAudioBackend::control_app_name () const
{
std::string ignored;
if (PBD::find_file (PBD::Searchpath (Glib::getenv("PATH")), X_("pavucontrol"), ignored)) {
return "pavucontrol";
}
return "";
}
void
PulseAudioBackend::launch_control_app ()
{
#ifdef NO_VFORK
(void) system ("pavucontrol");
#else
if (::vfork () == 0) {
::execlp ("pavucontrol", "pavucontrol", (char*)NULL);
exit (EXIT_SUCCESS);
}
#endif
}
/* State Control */
static void*

View File

@ -202,8 +202,8 @@ public:
uint32_t systemic_midi_output_latency (std::string const) const { return 0; }
/* External control app */
std::string control_app_name () const { return std::string (); }
void launch_control_app () { }
std::string control_app_name () const;
void launch_control_app ();
/* MIDI */
std::vector<std::string> enumerate_midi_options () const;