Store recently used backend with session
This is in preparation to warn a user in case the session is loaded with a different device and connections may be lost.
This commit is contained in:
parent
02ba5a7cd1
commit
0b00eabb19
|
@ -213,7 +213,7 @@ public:
|
|||
|
||||
virtual ~Session ();
|
||||
|
||||
static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& program_version);
|
||||
static int get_info_from_path (const std::string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& program_version, XMLNode* engine_hints = 0);
|
||||
static std::string get_snapshot_from_instant (const std::string& session_dir);
|
||||
|
||||
/** a monotonic counter used for naming user-visible things uniquely
|
||||
|
|
|
@ -1207,6 +1207,20 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass
|
|||
node->set_property ("name", _name);
|
||||
node->set_property ("sample-rate", _base_sample_rate);
|
||||
|
||||
/* store the last engine device we we can avoid autostarting on a different device with wrong i/o count */
|
||||
boost::shared_ptr<AudioBackend> backend = _engine.current_backend();
|
||||
if (_engine.running () && backend) {
|
||||
child = node->add_child ("EngineHints");
|
||||
child->set_property ("backend", backend-> name ());
|
||||
if (backend->use_separate_input_and_output_devices()) {
|
||||
child->set_property ("input-device", backend->input_device_name ());
|
||||
child->set_property ("output-device", backend->output_device_name ());
|
||||
} else {
|
||||
child->set_property ("input-device", backend->device_name ());
|
||||
child->set_property ("output-device", backend->device_name ());
|
||||
}
|
||||
}
|
||||
|
||||
if (session_dirs.size() > 1) {
|
||||
|
||||
string p;
|
||||
|
@ -4564,7 +4578,7 @@ Session::parse_stateful_loading_version (const std::string& version)
|
|||
}
|
||||
|
||||
int
|
||||
Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& program_version)
|
||||
Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFormat& data_format, std::string& program_version, XMLNode* engine_hints)
|
||||
{
|
||||
bool found_sr = false;
|
||||
bool found_data_format = false;
|
||||
|
@ -4630,6 +4644,24 @@ Session::get_info_from_path (const string& xmlpath, float& sample_rate, SampleFo
|
|||
}
|
||||
xmlFree (val);
|
||||
}
|
||||
if (engine_hints && strcmp((const char*) node->name, "EngineHints") == 0) {
|
||||
xmlChar* val = xmlGetProp (node, (const xmlChar*)"backend");
|
||||
if (val) {
|
||||
engine_hints->set_property ("backend", (const char*)val);
|
||||
}
|
||||
xmlFree (val);
|
||||
val = xmlGetProp (node, (const xmlChar*)"input-device");
|
||||
if (val) {
|
||||
engine_hints->set_property ("input-device", (const char*)val);
|
||||
}
|
||||
xmlFree (val);
|
||||
val = xmlGetProp (node, (const xmlChar*)"output-device");
|
||||
if (val) {
|
||||
engine_hints->set_property ("output-device", (const char*)val);
|
||||
}
|
||||
xmlFree (val);
|
||||
}
|
||||
|
||||
if (strcmp((const char*) node->name, "Config")) {
|
||||
node = node->next;
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue