always save/keep audio/MIDI setup states so that they are available for use *after* instances where JACK was already running

This commit is contained in:
Paul Davis 2013-09-05 14:21:25 -04:00
parent 1c49138e00
commit bc1cc154dc
7 changed files with 46 additions and 40 deletions

View file

@ -68,7 +68,6 @@ EngineControl::EngineControl ()
#else
, basic_packer (9, 2)
#endif
, _used (false)
{
using namespace Notebook_Helpers;
Label* label;
@ -471,31 +470,28 @@ EngineControl::get_state ()
XMLNode* root = new XMLNode ("AudioMIDISetup");
std::string path;
if (_used) {
if (!states.empty()) {
XMLNode* state_nodes = new XMLNode ("EngineStates");
if (!states.empty()) {
XMLNode* state_nodes = new XMLNode ("EngineStates");
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
for (StateList::const_iterator i = states.begin(); i != states.end(); ++i) {
XMLNode* node = new XMLNode ("State");
node->add_property ("backend", (*i).backend);
node->add_property ("driver", (*i).driver);
node->add_property ("device", (*i).device);
node->add_property ("sample-rate", (*i).sample_rate);
node->add_property ("buffer-size", (*i).buffer_size);
node->add_property ("input-latency", (*i).input_latency);
node->add_property ("output-latency", (*i).output_latency);
node->add_property ("input-channels", (*i).input_channels);
node->add_property ("output-channels", (*i).output_channels);
node->add_property ("active", (*i).active ? "yes" : "no");
state_nodes->add_child_nocopy (*node);
}
root->add_child_nocopy (*state_nodes);
XMLNode* node = new XMLNode ("State");
node->add_property ("backend", (*i).backend);
node->add_property ("driver", (*i).driver);
node->add_property ("device", (*i).device);
node->add_property ("sample-rate", (*i).sample_rate);
node->add_property ("buffer-size", (*i).buffer_size);
node->add_property ("input-latency", (*i).input_latency);
node->add_property ("output-latency", (*i).output_latency);
node->add_property ("input-channels", (*i).input_channels);
node->add_property ("output-channels", (*i).output_channels);
node->add_property ("active", (*i).active ? "yes" : "no");
state_nodes->add_child_nocopy (*node);
}
root->add_child_nocopy (*state_nodes);
}
return *root;
@ -518,6 +514,7 @@ EngineControl::set_state (const XMLNode& root)
states.clear ();
for (citer = clist.begin(); citer != clist.end(); ++citer) {
child = *citer;
@ -653,13 +650,6 @@ EngineControl::setup_engine (bool start)
return -1;
}
/* we've used this dialog to configure the engine, which means
* that our state becomes relevant for saving (and thus
* implicitly, restoring.
*/
_used = true;
/* get a pointer to the current state object, creating one if
* necessary
*/