This commit is contained in:
kiilerix 2025-11-28 18:12:52 -08:00 committed by GitHub
commit 13305304af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 106 additions and 165 deletions

View file

@ -866,7 +866,7 @@ ARDOUR_UI::load_from_application_api (const std::string& path)
#else
"JACK",
#endif
ARDOUR_COMMAND_LINE::backend_client_name, "")) {
ARDOUR_COMMAND_LINE::backend_session_id, "")) {
error << _("NSM: The JACK backend is mandatory and can not be loaded.") << endmsg;
return;
}

View file

@ -1030,7 +1030,7 @@ EngineControl::backend_changed ()
string backend_name = backend_combo.get_active_text ();
std::shared_ptr<ARDOUR::AudioBackend> backend;
if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (backend_name, ARDOUR_COMMAND_LINE::backend_client_name, ""))) {
if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (backend_name, ARDOUR_COMMAND_LINE::backend_session_id, ""))) {
/* eh? setting the backend failed... how ? */
/* A: stale config contains a backend that does not exist in current build */
return;
@ -1152,7 +1152,7 @@ EngineControl::get_default_device (const string& current_device_name,
using namespace ARDOUR;
string default_device_name =
AudioBackend::get_standard_device_name (AudioBackend::DeviceDefault);
AudioBackend::get_default_device_name ();
vector<string>::const_iterator i;
@ -1164,7 +1164,7 @@ EngineControl::get_default_device (const string& current_device_name,
}
string none_device_name =
AudioBackend::get_standard_device_name (AudioBackend::DeviceNone);
AudioBackend::get_none_device_name ();
// Use the first device that isn't "None"
for (i = available_devices.begin (); i != available_devices.end (); ++i) {
@ -1587,7 +1587,7 @@ EngineControl::input_device_changed ()
std::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance ()->current_backend ();
if (backend && backend->match_input_output_devices_or_none ()) {
const std::string& dev_none = ARDOUR::AudioBackend::get_standard_device_name (ARDOUR::AudioBackend::DeviceNone);
const std::string& dev_none = ARDOUR::AudioBackend::get_none_device_name ();
if (get_output_device_name () != dev_none && get_input_device_name () != dev_none && get_input_device_name () != get_output_device_name ()) {
block_changed_signals ();
@ -1609,7 +1609,7 @@ EngineControl::output_device_changed ()
DEBUG_ECONTROL ("output_device_changed");
std::shared_ptr<ARDOUR::AudioBackend> backend = ARDOUR::AudioEngine::instance ()->current_backend ();
if (backend && backend->match_input_output_devices_or_none ()) {
const std::string& dev_none = ARDOUR::AudioBackend::get_standard_device_name (ARDOUR::AudioBackend::DeviceNone);
const std::string& dev_none = ARDOUR::AudioBackend::get_none_device_name ();
if (get_input_device_name () != dev_none && get_input_device_name () != dev_none && get_input_device_name () != get_output_device_name ()) {
block_changed_signals ();
@ -2213,7 +2213,7 @@ EngineControl::set_current_state (const State& state)
std::shared_ptr<ARDOUR::AudioBackend> backend;
if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (state->backend, ARDOUR_COMMAND_LINE::backend_client_name, ""))) {
if (!(backend = ARDOUR::AudioEngine::instance ()->set_backend (state->backend, ARDOUR_COMMAND_LINE::backend_session_id, ""))) {
DEBUG_ECONTROL (string_compose ("Unable to set backend to %1", state->backend));
// this shouldn't happen as the invalid backend names should have been
// removed from the list of states.
@ -2495,7 +2495,7 @@ EngineControl::push_state_to_backend (bool start)
error << string_compose (_("Cannot set buffer size to %1"), get_buffer_size ()) << endmsg;
return 1;
}
if (change_nperiods && backend->set_peridod_size (get_nperiods ())) {
if (change_nperiods && backend->set_period_size (get_nperiods ())) {
error << string_compose (_("Cannot set periods to %1"), get_nperiods ()) << endmsg;
return 1;
}

View file

@ -48,7 +48,7 @@ NSM_Client::command_open(const char* name,
{
int r = ERR_OK;
ARDOUR_COMMAND_LINE::backend_client_name = client_id;
ARDOUR_COMMAND_LINE::backend_session_id = client_id;
ARDOUR_COMMAND_LINE::session_name = "";
/* this appears asynchronous, but almost certainly is

View file

@ -41,7 +41,7 @@
using namespace std;
string ARDOUR_COMMAND_LINE::session_name = "";
string ARDOUR_COMMAND_LINE::backend_client_name = PBD::downcase(PROGRAM_NAME);
string ARDOUR_COMMAND_LINE::backend_session_id = PBD::downcase(PROGRAM_NAME);
bool ARDOUR_COMMAND_LINE::show_key_actions = false;
bool ARDOUR_COMMAND_LINE::show_actions = false;
bool ARDOUR_COMMAND_LINE::no_splash = false;
@ -72,7 +72,7 @@ print_help (const char *execname)
<< _(" -A, --actions Print all possible menu action names\n")
<< _(" -b, --bindings Display all current key bindings\n")
<< _(" -B, --bypass-plugins Bypass all plugins in an existing session\n")
<< _(" -c, --name <name> Use a specific backend client name, default is ardour\n")
<< _(" -c, --name <session-id> Specify audio backend client session id, default is ardour\n")
<< _(" -d, --disable-plugins Disable all plugins (safe mode)\n")
#ifndef NDEBUG
<< _(" -D, --debug <options> Set debug flags. Use \"-D list\" to see available options\n")
@ -218,7 +218,7 @@ ARDOUR_COMMAND_LINE::parse_opts (int argc, char *argv[])
break;
case 'c':
backend_client_name = optarg;
backend_session_id = optarg;
break;
case 'k':

View file

@ -29,7 +29,7 @@ extern bool show_key_actions;
extern bool show_actions;
extern bool no_splash;
extern bool just_version;
extern std::string backend_client_name;
extern std::string backend_session_id;
extern bool new_session;
extern bool try_hw_optimization;
extern bool no_connect_ports;

View file

@ -48,7 +48,7 @@ using namespace PBD;
static const char* localedir = LOCALEDIR;
static string backend_client_name;
static string backend_session_id;
static CrossThreadChannel xthread (true);
static TestReceiver test_receiver;
@ -72,7 +72,7 @@ load_session (string dir, string state)
AudioEngine* engine = AudioEngine::create ();
if (!engine->set_backend (backend_name, backend_client_name, "")) {
if (!engine->set_backend (backend_name, backend_session_id, "")) {
std::cerr << "Cannot set Audio/MIDI engine backend\n";
exit (EXIT_FAILURE);
}
@ -172,7 +172,7 @@ main (int argc, char* argv[])
bool try_hw_optimization = true;
backend_client_name = PBD::downcase (std::string (PROGRAM_NAME));
backend_session_id = PBD::downcase (std::string (PROGRAM_NAME));
int c;
while ((c = getopt_long (argc, argv, optstring, longopts, (int*)0)) != EOF) {
@ -191,7 +191,7 @@ main (int argc, char* argv[])
break;
case 'c':
backend_client_name = optarg;
backend_session_id = optarg;
break;
case 'B':

View file

@ -44,11 +44,11 @@ namespace ARDOUR
struct LIBARDOUR_API AudioBackendInfo {
const char* name;
/** Using arg1 and arg2, initialize this audiobackend.
/** Using client_name and session_id, initialize this audiobackend.
*
* Returns zero on success, non-zero otherwise.
*/
int (*instantiate) (const std::string& arg1, const std::string& arg2);
int (*instantiate) (const std::string& client_name, const std::string& session_id);
/** Release all resources associated with this audiobackend */
int (*deinstantiate) (void);
@ -131,12 +131,8 @@ public:
static std::string get_error_string (ErrorCode);
enum StandardDeviceName {
DeviceNone,
DeviceDefault
};
static std::string get_standard_device_name (StandardDeviceName);
static std::string get_none_device_name ();
static std::string get_default_device_name ();
/** Return the AudioBackendInfo object from which this backend
* was constructed.
@ -153,15 +149,10 @@ public:
*/
virtual std::string name () const = 0;
/** Return true if the callback from the underlying mechanism/API
* (CoreAudio, JACK, ASIO etc.) occurs in a thread subject to realtime
* constraints. Return false otherwise.
*/
virtual bool is_realtime () const = 0;
/** Return true if the backed is JACK */
/** Return true if the backend is JACK */
virtual bool is_jack () const { return false; }
/** Return the priority to be set with pbd_set_engine_rt_priority. */
virtual int client_real_time_priority () { return 0; }
/* Discovering devices and parameters */
@ -232,7 +223,7 @@ public:
* of allowing one to be "None".
*
* ie. Input Device must match Output Device, except if either of them
* is get_standard_device_name (DeviceNone).
* is get_none_device_name ().
*/
virtual bool match_input_output_devices_or_none () const
{
@ -291,7 +282,7 @@ public:
/** Set the period size to be used.
* must be called before starting the backend.
*/
virtual int set_peridod_size (uint32_t)
virtual int set_period_size (uint32_t)
{
return -1;
}

View file

@ -71,7 +71,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
int discover_backends();
std::vector<const AudioBackendInfo*> available_backends() const;
std::string current_backend_name () const;
std::shared_ptr<AudioBackend> set_backend (const std::string&, const std::string& arg1, const std::string& arg2);
std::shared_ptr<AudioBackend> set_backend (const std::string& name, const std::string& client_name, const std::string& session_id);
std::shared_ptr<AudioBackend> current_backend() const { return _backend; }
bool setup_required () const;
bool is_jack () const;

View file

@ -100,15 +100,15 @@ AudioBackend::get_error_string (ErrorCode error_code)
}
std::string
AudioBackend::get_standard_device_name (StandardDeviceName device_name)
AudioBackend::get_none_device_name ()
{
switch (device_name) {
case DeviceNone:
return _("None");
case DeviceDefault:
return _("Default");
}
return std::string();
return _("None");
}
std::string
AudioBackend::get_default_device_name ()
{
return _("Default");
}
} // namespace ARDOUR

View file

@ -1014,7 +1014,7 @@ AudioEngine::drop_backend ()
}
std::shared_ptr<AudioBackend>
AudioEngine::set_backend (const std::string& name, const std::string& arg1, const std::string& arg2)
AudioEngine::set_backend (const std::string& name, const std::string& client_name, const std::string& session_id)
{
BackendMap::iterator b = _backends.find (name);
@ -1025,7 +1025,7 @@ AudioEngine::set_backend (const std::string& name, const std::string& arg1, cons
drop_backend ();
try {
if (b->second->instantiate (arg1, arg2)) {
if (b->second->instantiate (client_name, session_id)) {
throw failed_constructor ();
}
@ -1066,11 +1066,7 @@ AudioEngine::start (bool for_latency)
return -1;
}
if (_backend->is_realtime ()) {
pbd_set_engine_rt_priority (_backend->client_real_time_priority ());
} else {
pbd_set_engine_rt_priority (0);
}
pbd_set_engine_rt_priority (_backend->client_real_time_priority ());
_running = true;

View file

@ -2970,7 +2970,7 @@ LuaBindings::common (lua_State* L)
.addFunction ("set_sample_rate", &AudioBackend::set_sample_rate)
.addFunction ("set_buffer_size", &AudioBackend::set_buffer_size)
.addFunction ("set_peridod_size", &AudioBackend::set_peridod_size)
.addFunction ("set_period_size", &AudioBackend::set_period_size)
.addFunction ("enumerate_drivers", &AudioBackend::enumerate_drivers)
.addFunction ("driver_name", &AudioBackend::driver_name)

View file

@ -98,12 +98,6 @@ AlsaAudioBackend::name () const
return X_("ALSA");
}
bool
AlsaAudioBackend::is_realtime () const
{
return true;
}
std::vector<AudioBackend::DeviceStatus>
AlsaAudioBackend::enumerate_devices () const
{
@ -128,7 +122,7 @@ AlsaAudioBackend::enumerate_input_devices () const
_input_audio_device_status.clear ();
std::map<std::string, std::string> devices;
get_alsa_audio_device_names (devices, HalfDuplexIn);
_input_audio_device_status.push_back (DeviceStatus (get_standard_device_name (DeviceNone), true));
_input_audio_device_status.push_back (DeviceStatus (get_none_device_name (), true));
for (std::map<std::string, std::string>::const_iterator i = devices.begin (); i != devices.end (); ++i) {
if (_input_audio_device == "") {
_input_audio_device = i->first;
@ -144,7 +138,7 @@ AlsaAudioBackend::enumerate_output_devices () const
_output_audio_device_status.clear ();
std::map<std::string, std::string> devices;
get_alsa_audio_device_names (devices, HalfDuplexOut);
_output_audio_device_status.push_back (DeviceStatus (get_standard_device_name (DeviceNone), true));
_output_audio_device_status.push_back (DeviceStatus (get_none_device_name (), true));
for (std::map<std::string, std::string>::const_iterator i = devices.begin (); i != devices.end (); ++i) {
if (_output_audio_device == "") {
_output_audio_device = i->first;
@ -158,11 +152,11 @@ std::vector<float>
AlsaAudioBackend::available_sample_rates2 (const std::string& input_device, const std::string& output_device) const
{
std::vector<float> sr;
if (input_device == get_standard_device_name (DeviceNone) && output_device == get_standard_device_name (DeviceNone)) {
if (input_device == get_none_device_name () && output_device == get_none_device_name ()) {
return sr;
} else if (input_device == get_standard_device_name (DeviceNone)) {
} else if (input_device == get_none_device_name ()) {
sr = available_sample_rates (output_device);
} else if (output_device == get_standard_device_name (DeviceNone)) {
} else if (output_device == get_none_device_name ()) {
sr = available_sample_rates (input_device);
} else {
std::vector<float> sr_in = available_sample_rates (input_device);
@ -177,7 +171,7 @@ AlsaAudioBackend::available_sample_rates (const std::string& device) const
{
ALSADeviceInfo* nfo = NULL;
std::vector<float> sr;
if (device == get_standard_device_name (DeviceNone)) {
if (device == get_none_device_name ()) {
return sr;
}
if (device == _input_audio_device && _input_audio_device_info.valid) {
@ -201,11 +195,11 @@ std::vector<uint32_t>
AlsaAudioBackend::available_buffer_sizes2 (const std::string& input_device, const std::string& output_device) const
{
std::vector<uint32_t> bs;
if (input_device == get_standard_device_name (DeviceNone) && output_device == get_standard_device_name (DeviceNone)) {
if (input_device == get_none_device_name () && output_device == get_none_device_name ()) {
return bs;
} else if (input_device == get_standard_device_name (DeviceNone)) {
} else if (input_device == get_none_device_name ()) {
bs = available_buffer_sizes (output_device);
} else if (output_device == get_standard_device_name (DeviceNone)) {
} else if (output_device == get_none_device_name ()) {
bs = available_buffer_sizes (input_device);
} else {
std::vector<uint32_t> bs_in = available_buffer_sizes (input_device);
@ -220,7 +214,7 @@ AlsaAudioBackend::available_buffer_sizes (const std::string& device) const
{
ALSADeviceInfo* nfo = NULL;
std::vector<uint32_t> bs;
if (device == get_standard_device_name (DeviceNone)) {
if (device == get_none_device_name ()) {
return bs;
}
if (device == _input_audio_device && _input_audio_device_info.valid) {
@ -261,7 +255,7 @@ AlsaAudioBackend::available_period_sizes (const std::string& driver, const std::
ps.push_back (2);
ALSADeviceInfo* nfo = NULL;
if (device == get_standard_device_name (DeviceNone)) {
if (device == get_none_device_name ()) {
return ps;
}
@ -300,7 +294,7 @@ AlsaAudioBackend::set_input_device_name (const std::string& d)
}
_input_audio_device = d;
if (d == get_standard_device_name (DeviceNone)) {
if (d == get_none_device_name ()) {
_input_audio_device_info.valid = false;
return 0;
}
@ -333,7 +327,7 @@ AlsaAudioBackend::set_output_device_name (const std::string& d)
_output_audio_device = d;
if (d == get_standard_device_name (DeviceNone)) {
if (d == get_none_device_name ()) {
_output_audio_device_info.valid = false;
return 0;
}
@ -368,7 +362,7 @@ AlsaAudioBackend::set_device_name (const std::string& d)
bool
AlsaAudioBackend::can_measure_systemic_latency () const
{
return _input_audio_device == _output_audio_device && _input_audio_device != get_standard_device_name (DeviceNone);
return _input_audio_device == _output_audio_device && _input_audio_device != get_none_device_name ();
}
int
@ -383,7 +377,7 @@ AlsaAudioBackend::set_sample_rate (float sr)
}
int
AlsaAudioBackend::set_peridod_size (uint32_t n)
AlsaAudioBackend::set_period_size (uint32_t n)
{
if (n == 0) {
return -1;
@ -523,10 +517,10 @@ AlsaAudioBackend::update_systemic_midi_latencies ()
std::string
AlsaAudioBackend::device_name () const
{
if (_input_audio_device != get_standard_device_name (DeviceNone)) {
if (_input_audio_device != get_none_device_name ()) {
return _input_audio_device;
}
if (_output_audio_device != get_standard_device_name (DeviceNone)) {
if (_output_audio_device != get_none_device_name ()) {
return _output_audio_device;
}
return "";
@ -610,7 +604,7 @@ AlsaAudioBackend::midi_device_info (std::string const name) const
}
}
assert (_midi_driver_option != get_standard_device_name (DeviceNone));
assert (_midi_driver_option != get_none_device_name ());
std::map<std::string, std::string> devices;
if (_midi_driver_option == _("ALSA raw devices")) {
@ -634,7 +628,7 @@ AlsaAudioBackend::enumerate_midi_options () const
if (_midi_options.empty ()) {
_midi_options.push_back (_("ALSA raw devices"));
_midi_options.push_back (_("ALSA sequencer"));
_midi_options.push_back (get_standard_device_name (DeviceNone));
_midi_options.push_back (get_none_device_name ());
}
return _midi_options;
}
@ -660,7 +654,7 @@ AlsaAudioBackend::enumerate_midi_devices () const
int
AlsaAudioBackend::set_midi_option (const std::string& opt)
{
if (opt != get_standard_device_name (DeviceNone) && opt != _("ALSA raw devices") && opt != _("ALSA sequencer")) {
if (opt != get_none_device_name () && opt != _("ALSA raw devices") && opt != _("ALSA sequencer")) {
return -1;
}
if (_run && _midi_driver_option != opt) {
@ -796,7 +790,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
std::map<std::string, std::string> devices;
if (_input_audio_device == get_standard_device_name (DeviceNone) && _output_audio_device == get_standard_device_name (DeviceNone)) {
if (_input_audio_device == get_none_device_name () && _output_audio_device == get_none_device_name ()) {
PBD::error << _("AlsaAudioBackend: At least one of input or output device needs to be set.");
return AudioDeviceInvalidError;
}
@ -807,7 +801,7 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
if (_input_audio_device != _output_audio_device) {
std::string input_audio_device (_input_audio_device);
std::string output_audio_device (_output_audio_device);
if (_input_audio_device != get_standard_device_name (DeviceNone) && _output_audio_device != get_standard_device_name (DeviceNone)) {
if (_input_audio_device != get_none_device_name () && _output_audio_device != get_none_device_name ()) {
/* Different devices for In + Out.
* Ideally use input as clock source, and resample output.
* But when using separate devices, input is usually one (or more)
@ -816,15 +810,15 @@ AlsaAudioBackend::_start (bool for_latency_measurement)
*/
if (getenv ("ARDOUR_ALSA_CLK")) {
slave_device = _output_audio_device;
output_audio_device = get_standard_device_name (DeviceNone); //XXX
output_audio_device = get_none_device_name (); // XXX
slave_duplex = AudioSlave::HalfDuplexOut;
} else {
slave_device = _input_audio_device;
input_audio_device = get_standard_device_name (DeviceNone); //XXX
input_audio_device = get_none_device_name (); // XXX
slave_duplex = AudioSlave::HalfDuplexIn;
}
}
if (input_audio_device != get_standard_device_name (DeviceNone)) {
if (input_audio_device != get_none_device_name ()) {
get_alsa_audio_device_names (devices, HalfDuplexIn);
audio_device = input_audio_device;
duplex = 1;
@ -1465,7 +1459,7 @@ AlsaAudioBackend::register_system_midi_ports (const std::string device)
{
std::map<std::string, std::string> devices;
if (_midi_driver_option == get_standard_device_name (DeviceNone)) {
if (_midi_driver_option == get_none_device_name ()) {
return 0;
} else if (_midi_driver_option == _("ALSA raw devices")) {
get_alsa_rawmidi_device_names (devices);
@ -2186,7 +2180,7 @@ AlsaAudioBackend::AudioSlave::update_latencies (uint32_t play, uint32_t capt)
static std::shared_ptr<AlsaAudioBackend> _instance;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
static int instantiate (const std::string& client_name, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -2210,9 +2204,9 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& client_name, const std::string& /* session_id */)
{
s_instance_name = arg1;
s_instance_name = client_name;
return 0;
}

View file

@ -125,7 +125,6 @@ class AlsaAudioBackend : public AudioBackend, public PortEngineSharedImpl
/* AUDIOBACKEND API */
std::string name () const;
bool is_realtime () const;
bool use_separate_input_and_output_devices () const { return true; }
bool match_input_output_devices_or_none () const { return false; }
@ -154,7 +153,7 @@ class AlsaAudioBackend : public AudioBackend, public PortEngineSharedImpl
int set_output_device_name (const std::string&);
int set_sample_rate (float);
int set_buffer_size (uint32_t);
int set_peridod_size (uint32_t);
int set_period_size (uint32_t);
int set_interleaved (bool yn);
int set_systemic_input_latency (uint32_t);
int set_systemic_output_latency (uint32_t);

View file

@ -148,12 +148,6 @@ CoreAudioBackend::name () const
return X_("CoreAudio");
}
bool
CoreAudioBackend::is_realtime () const
{
return true;
}
std::vector<AudioBackend::DeviceStatus>
CoreAudioBackend::enumerate_devices () const
{
@ -176,7 +170,7 @@ CoreAudioBackend::enumerate_input_devices () const
std::map<size_t, std::string> devices;
_pcmio->input_device_list(devices);
_input_audio_device_status.push_back (DeviceStatus (get_standard_device_name(DeviceNone), true));
_input_audio_device_status.push_back (DeviceStatus (get_none_device_name (), true));
for (std::map<size_t, std::string>::const_iterator i = devices.begin (); i != devices.end(); ++i) {
if (_input_audio_device == "") _input_audio_device = i->second;
_input_audio_device_status.push_back (DeviceStatus (i->second, true));
@ -192,7 +186,7 @@ CoreAudioBackend::enumerate_output_devices () const
std::map<size_t, std::string> devices;
_pcmio->output_device_list(devices);
_output_audio_device_status.push_back (DeviceStatus (get_standard_device_name(DeviceNone), true));
_output_audio_device_status.push_back (DeviceStatus (get_none_device_name (), true));
for (std::map<size_t, std::string>::const_iterator i = devices.begin (); i != devices.end(); ++i) {
if (_output_audio_device == "") _output_audio_device = i->second;
_output_audio_device_status.push_back (DeviceStatus (i->second, true));
@ -416,7 +410,7 @@ CoreAudioBackend::enumerate_midi_options () const
{
if (_midi_options.empty()) {
_midi_options.push_back (_("CoreMidi"));
_midi_options.push_back (get_standard_device_name(DeviceNone));
_midi_options.push_back (get_none_device_name ());
}
return _midi_options;
}
@ -424,7 +418,7 @@ CoreAudioBackend::enumerate_midi_options () const
int
CoreAudioBackend::set_midi_option (const std::string& opt)
{
if (opt != get_standard_device_name(DeviceNone) && opt != _("CoreMidi")) {
if (opt != get_none_device_name () && opt != _("CoreMidi")) {
return -1;
}
_midi_driver_option = opt;
@ -1534,7 +1528,7 @@ CoreAudioBackend::hw_changed_callback ()
static std::shared_ptr<CoreAudioBackend> _instance;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
static int instantiate (const std::string& client_name, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1558,9 +1552,9 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& client_name, const std::string& /* session_id */)
{
s_instance_name = arg1;
s_instance_name = client_name;
return 0;
}

View file

@ -160,7 +160,6 @@ class CoreAudioBackend : public AudioBackend, public PortEngineSharedImpl {
/* AUDIOBACKEND API */
std::string name () const;
bool is_realtime () const;
bool use_separate_input_and_output_devices () const { return true; }
std::vector<DeviceStatus> enumerate_devices () const;

View file

@ -109,12 +109,6 @@ DummyAudioBackend::name () const
return X_("Dummy"); // internal name
}
bool
DummyAudioBackend::is_realtime () const
{
return false;
}
std::vector<AudioBackend::DeviceStatus>
DummyAudioBackend::enumerate_devices () const
{
@ -1021,7 +1015,7 @@ DummyAudioBackend::main_process_thread ()
static std::shared_ptr<DummyAudioBackend> _instance;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
static int instantiate (const std::string& client_name, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1045,9 +1039,9 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& client_name, const std::string& /* session_id */)
{
s_instance_name = arg1;
s_instance_name = client_name;
return 0;
}

View file

@ -194,7 +194,6 @@ class DummyAudioBackend : public AudioBackend, public PortEngineSharedImpl
/* AUDIOBACKEND API */
std::string name () const;
bool is_realtime () const;
bool requires_driver_selection() const { return true; }
std::string driver_name () const;

View file

@ -25,7 +25,7 @@ static std::shared_ptr<JACKAudioBackend> backend;
static std::shared_ptr<JackConnection> jack_connection;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& ae);
static int instantiate (const std::string& arg1, const std::string& arg2);
static int instantiate (const std::string& client_name, const std::string& session_id);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -58,10 +58,10 @@ backend_factory (AudioEngine& ae)
}
static int
instantiate (const std::string& arg1, const std::string& arg2)
instantiate (const std::string& client_name, const std::string& session_id)
{
try {
jack_connection.reset (new JackConnection (arg1, arg2));
jack_connection.reset (new JackConnection (client_name, session_id));
backend.reset ();
} catch (...) {
return -1;

View file

@ -105,13 +105,6 @@ JACKAudioBackend::available() const
return (private_handle() != 0);
}
bool
JACKAudioBackend::is_realtime () const
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack,false);
return jack_is_realtime (_priv_jack);
}
bool
JACKAudioBackend::requires_driver_selection() const
{
@ -262,7 +255,7 @@ JACKAudioBackend::set_sample_rate (float sr)
}
int
JACKAudioBackend::set_peridod_size (uint32_t nperiods)
JACKAudioBackend::set_period_size (uint32_t nperiods)
{
if (!available()) {
_target_num_periods = nperiods;
@ -882,6 +875,8 @@ int
JACKAudioBackend::client_real_time_priority ()
{
GET_PRIVATE_JACK_POINTER_RET (_priv_jack, 0);
if (!jack_is_realtime (_priv_jack))
return 0;
return jack_client_real_time_priority (_priv_jack);
}

View file

@ -58,7 +58,6 @@ class JACKAudioBackend : public AudioBackend {
std::string name() const;
void* private_handle() const;
bool is_realtime () const;
bool is_jack () const { return true; }
@ -78,7 +77,7 @@ class JACKAudioBackend : public AudioBackend {
int set_device_name (const std::string&);
int set_sample_rate (float);
int set_buffer_size (uint32_t);
int set_peridod_size (uint32_t);
int set_period_size (uint32_t);
int set_interleaved (bool yn);
int set_systemic_input_latency (uint32_t);
int set_systemic_output_latency (uint32_t);

View file

@ -50,10 +50,10 @@ static void jack_halted_info_callback (jack_status_t code, const char* reason, v
}
JackConnection::JackConnection (const std::string& arg1, const std::string& arg2)
JackConnection::JackConnection (const std::string& client_name, const std::string& session_id)
: _jack (0)
, _client_name (arg1)
, session_uuid (arg2)
, _client_name (client_name)
, _session_id (session_id)
, _probed_buffer_size (0)
, _probed_sample_rate (0)
{
@ -116,7 +116,7 @@ JackConnection::open ()
get_jack_server_dir_paths (dirs);
set_path_env_for_jack_autostart (dirs);
if ((_jack = jack_client_open (_client_name.c_str(), JackSessionID, &status, session_uuid.c_str())) == 0) {
if ((_jack = jack_client_open (_client_name.c_str(), JackSessionID, &status, _session_id.c_str())) == 0) {
return -1;
}

View file

@ -10,7 +10,7 @@ namespace ARDOUR {
class JackConnection {
public:
JackConnection (const std::string& client_name, const std::string& session_uuid);
JackConnection (const std::string& client_name, const std::string& session_id);
~JackConnection ();
const std::string& client_name() const { return _client_name; }
@ -35,7 +35,7 @@ class JackConnection {
private:
jack_client_t* volatile _jack;
std::string _client_name;
std::string session_uuid;
std::string _session_id;
static bool _in_control;
uint32_t _probed_buffer_size; // when not in control
uint32_t _probed_sample_rate; // when not in control

View file

@ -116,12 +116,6 @@ PortAudioBackend::name () const
return X_("PortAudio");
}
bool
PortAudioBackend::is_realtime () const
{
return true;
}
bool
PortAudioBackend::requires_driver_selection() const
{
@ -426,7 +420,7 @@ PortAudioBackend::enumerate_midi_options () const
{
if (_midi_options.empty()) {
_midi_options.push_back (winmme_driver_name);
_midi_options.push_back (get_standard_device_name(DeviceNone));
_midi_options.push_back (get_none_device_name ());
}
return _midi_options;
}
@ -434,7 +428,7 @@ PortAudioBackend::enumerate_midi_options () const
int
PortAudioBackend::set_midi_option (const std::string& opt)
{
if (opt != get_standard_device_name(DeviceNone) && opt != winmme_driver_name) {
if (opt != get_none_device_name () && opt != winmme_driver_name) {
return -1;
}
DEBUG_MIDI (string_compose ("Setting midi option to %1\n", opt));
@ -1218,7 +1212,7 @@ PortAudioBackend::register_system_audio_ports()
int
PortAudioBackend::register_system_midi_ports (std::string const& device)
{
if (_midi_driver_option == get_standard_device_name(DeviceNone)) {
if (_midi_driver_option == get_none_device_name ()) {
DEBUG_MIDI("No MIDI backend selected, not system midi ports available\n");
return 0;
}
@ -1797,7 +1791,7 @@ PortAudioBackend::process_port_connection_changes ()
static std::shared_ptr<PortAudioBackend> _instance;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
static int instantiate (const std::string& client_name, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1821,9 +1815,9 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& client_name, const std::string& /* session_id */)
{
s_instance_name = arg1;
s_instance_name = client_name;
return 0;
}

View file

@ -99,7 +99,6 @@ class PortAudioBackend : public AudioBackend, public PortEngineSharedImpl {
/* AUDIOBACKEND API */
std::string name () const;
bool is_realtime () const;
bool requires_driver_selection() const;
std::string driver_name () const;

View file

@ -484,9 +484,9 @@ void
PortAudioIO::add_none_devices ()
{
_input_devices.insert(std::pair<int, paDevice*>(
DeviceNone, new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceNone), 0, 0)));
DeviceNone, new paDevice (AudioBackend::get_none_device_name (), 0, 0)));
_output_devices.insert(std::pair<int, paDevice*>(
DeviceNone, new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceNone), 0, 0)));
DeviceNone, new paDevice (AudioBackend::get_none_device_name (), 0, 0)));
}
void
@ -499,12 +499,12 @@ PortAudioIO::add_default_devices ()
const PaDeviceInfo* nfo_o = Pa_GetDeviceInfo(get_default_output_device());
if (nfo_i && nfo_o) {
_input_devices.insert (std::pair<int, paDevice*> (DeviceDefault,
new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceDefault),
new paDevice(AudioBackend::get_default_device_name (),
nfo_i->maxInputChannels,
nfo_o->maxOutputChannels
)));
_output_devices.insert (std::pair<int, paDevice*> (DeviceDefault,
new paDevice(AudioBackend::get_standard_device_name(AudioBackend::DeviceDefault),
new paDevice(AudioBackend::get_default_device_name (),
nfo_i->maxInputChannels,
nfo_o->maxOutputChannels
)));

View file

@ -34,11 +34,6 @@ public:
PortAudioIO (void);
~PortAudioIO (void);
enum StandardDevices {
DeviceNone = -2,
DeviceDefault = -1
};
void host_api_list (std::vector<std::string>&);
bool set_host_api (const std::string& host_api_name);
std::string get_host_api () const { return _host_api_name; }

View file

@ -331,12 +331,6 @@ PulseAudioBackend::name () const
return X_("PulseAudio");
}
bool
PulseAudioBackend::is_realtime () const
{
return true;
}
std::vector<AudioBackend::DeviceStatus>
PulseAudioBackend::enumerate_devices () const
{
@ -481,7 +475,7 @@ std::vector<std::string>
PulseAudioBackend::enumerate_midi_options () const
{
std::vector<std::string> midi_options;
midi_options.push_back (get_standard_device_name (DeviceNone));
midi_options.push_back (get_none_device_name ());
return midi_options;
}
@ -500,7 +494,7 @@ PulseAudioBackend::set_midi_option (const std::string& opt)
std::string
PulseAudioBackend::midi_option () const
{
return get_standard_device_name (DeviceNone);
return get_none_device_name ();
}
/* External control app */
@ -1089,7 +1083,7 @@ PulseAudioBackend::main_process_thread ()
static std::shared_ptr<PulseAudioBackend> _instance;
static std::shared_ptr<AudioBackend> backend_factory (AudioEngine& e);
static int instantiate (const std::string& arg1, const std::string& /* arg2 */);
static int instantiate (const std::string& client_name, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1113,9 +1107,9 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& client_name, const std::string& /* session_id */)
{
s_instance_name = arg1;
s_instance_name = client_name;
return 0;
}

View file

@ -102,7 +102,6 @@ public:
/* AUDIOBACKEND API */
std::string name () const;
bool is_realtime () const;
std::vector<DeviceStatus> enumerate_devices () const;
std::vector<float> available_sample_rates (const std::string& device) const;