audio_backend: Rename instantiate() parameter arg2 to session_id

The thing called backend_client_name defaulted to lowercase PROGRAM_NAME
and could be controlled with:

    -c, --name <name>           Use a specific backend client name, default is ardour

This value was *only* used for set_backend arg2 which only is used for
jack, where it was called session_uuid and passed to jack_client_open as
"a SessionID Token this allows the sessionmanager to identify the client
again" because JackSessionID.

It is certainly misleading to call it a uuid. It also doesn't seem
helpful to call it "client name" when the documentation calls it
"session id". And mostly: jack_client_open calls its *first* argument
"client_name" and it comes from argv1.

To clear things up, consistently call it something with "session id".
And it is not helpful to use a generic arg2 naming.
This commit is contained in:
Mads Kiilerich 2024-10-20 18:44:43 +02:00
parent 9c0c4f527b
commit 710bd07cd4
17 changed files with 35 additions and 35 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

@ -1024,7 +1024,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;
@ -2207,7 +2207,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.

View file

@ -49,7 +49,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 arg1 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& arg1, const std::string& session_id);
/** Release all resources associated with this audiobackend */
int (*deinstantiate) (void);

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& arg1, const std::string& session_id);
std::shared_ptr<AudioBackend> current_backend() const { return _backend; }
bool setup_required () const;
bool is_jack () const;

View file

@ -1015,7 +1015,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& arg1, const std::string& session_id)
{
BackendMap::iterator b = _backends.find (name);
@ -1026,7 +1026,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 (arg1, session_id)) {
throw failed_constructor ();
}

View file

@ -2181,7 +2181,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& arg1, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -2205,7 +2205,7 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& arg1, const std::string& /* session_id */)
{
s_instance_name = arg1;
return 0;

View file

@ -1529,7 +1529,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& arg1, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1553,7 +1553,7 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& arg1, const std::string& /* session_id */)
{
s_instance_name = arg1;
return 0;

View file

@ -1016,7 +1016,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& arg1, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1040,7 +1040,7 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& arg1, const std::string& /* session_id */)
{
s_instance_name = arg1;
return 0;

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& arg1, 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& arg1, const std::string& session_id)
{
try {
jack_connection.reset (new JackConnection (arg1, arg2));
jack_connection.reset (new JackConnection (arg1, session_id));
backend.reset ();
} catch (...) {
return -1;

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& arg1, const std::string& session_id)
: _jack (0)
, _client_name (arg1)
, session_uuid (arg2)
, _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

@ -1793,7 +1793,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& arg1, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1817,7 +1817,7 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& arg1, const std::string& /* session_id */)
{
s_instance_name = arg1;
return 0;

View file

@ -1084,7 +1084,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& arg1, const std::string& /* session_id */);
static int deinstantiate ();
static bool already_configured ();
static bool available ();
@ -1108,7 +1108,7 @@ backend_factory (AudioEngine& e)
}
static int
instantiate (const std::string& arg1, const std::string& /* arg2 */)
instantiate (const std::string& arg1, const std::string& /* session_id */)
{
s_instance_name = arg1;
return 0;