summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-09-12 17:06:21 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-09-12 17:25:01 -0400
commit28d692b4900d8c428c2cd3b9008c897ec8943724 (patch)
treef4505cabcf412c17285ef2d062b73cf733c8c384 /libs
parent8432f78346800a8e897d79deb61396b67cbd9c18 (diff)
don't stop metering thread when session is removed; move engine-setup code into its own method. sorry, ardour build-from-source folk :)
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/audioengine.cc2
-rw-r--r--libs/ardour/session.cc65
3 files changed, 34 insertions, 34 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 09bf75276d..1d81473f1d 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -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
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 819a166866..08af41f5f8 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -425,8 +425,6 @@ AudioEngine::remove_session ()
if (_running) {
- stop_metering_thread ();
-
if (_session) {
session_remove_pending = true;
session_removal_countdown = 0;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 94882c13b3..cad869a577 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -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 ()
{