don't stop metering thread when session is removed; move engine-setup code into its own method. sorry, ardour build-from-source folk :)
This commit is contained in:
parent
8432f78346
commit
28d692b490
|
@ -1624,6 +1624,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
void setup_ltc ();
|
||||
void setup_click ();
|
||||
void setup_bundles ();
|
||||
int ensure_engine (uint32_t desired_sample_rate);
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
@ -425,8 +425,6 @@ AudioEngine::remove_session ()
|
|||
|
||||
if (_running) {
|
||||
|
||||
stop_metering_thread ();
|
||||
|
||||
if (_session) {
|
||||
session_remove_pending = true;
|
||||
session_removal_countdown = 0;
|
||||
|
|
|
@ -286,39 +286,9 @@ Session::Session (AudioEngine &eng,
|
|||
}
|
||||
}
|
||||
|
||||
/* we need the audioengine to be up and usable to make much more
|
||||
* progress with construction, so lets get that started if it isn't already.
|
||||
*/
|
||||
|
||||
if (_engine.current_backend() == 0) {
|
||||
/* backend is unknown ... */
|
||||
boost::optional<int> r = AudioEngineSetupRequired (sr);
|
||||
if (r.get_value_or (-1) != 0) {
|
||||
destroy ();
|
||||
throw failed_constructor();
|
||||
}
|
||||
} else if (_engine.setup_required()) {
|
||||
/* backend is known, but setup is needed */
|
||||
boost::optional<int> r = AudioEngineSetupRequired (sr);
|
||||
if (r.get_value_or (-1) != 0) {
|
||||
destroy ();
|
||||
throw failed_constructor();
|
||||
}
|
||||
} else if (!_engine.running()) {
|
||||
if (_engine.start()) {
|
||||
destroy ();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
}
|
||||
|
||||
/* at this point the engine should be connected (i.e. interacting
|
||||
with a backend device (or psuedo-device) and available to us
|
||||
for determinining sample rates and other settings.
|
||||
*/
|
||||
|
||||
if (!_engine.connected()) {
|
||||
if (ensure_engine (sr)) {
|
||||
destroy ();
|
||||
throw failed_constructor();
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
if (post_engine_init ()) {
|
||||
|
@ -363,6 +333,37 @@ Session::~Session ()
|
|||
destroy ();
|
||||
}
|
||||
|
||||
int
|
||||
Session::ensure_engine (uint32_t desired_sample_rate)
|
||||
{
|
||||
if (_engine.current_backend() == 0) {
|
||||
/* backend is unknown ... */
|
||||
boost::optional<int> r = AudioEngineSetupRequired (desired_sample_rate);
|
||||
if (r.get_value_or (-1) != 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (_engine.setup_required()) {
|
||||
/* backend is known, but setup is needed */
|
||||
boost::optional<int> r = AudioEngineSetupRequired (desired_sample_rate);
|
||||
if (r.get_value_or (-1) != 0) {
|
||||
return -1;
|
||||
}
|
||||
} else if (!_engine.running()) {
|
||||
if (_engine.start()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* at this point the engine should be running
|
||||
*/
|
||||
|
||||
if (!_engine.running()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Session::destroy ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue