summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc71
1 files changed, 42 insertions, 29 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index c18b5dde38..16283d9232 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -455,7 +455,7 @@ AudioEngine::backend_reset_requested()
void
AudioEngine::do_reset_backend()
{
- SessionEvent::create_per_thread_pool (X_("Backend reset processing thread"), 512);
+ SessionEvent::create_per_thread_pool (X_("Backend reset processing thread"), 1024);
Glib::Threads::Mutex::Lock guard (_reset_request_lock);
@@ -468,25 +468,28 @@ AudioEngine::do_reset_backend()
Glib::Threads::RecMutex::Lock pl (_state_lock);
g_atomic_int_dec_and_test (&_hw_reset_request_count);
- std::cout << "AudioEngine::RESET::Reset request processing. Requests left: " << _hw_reset_request_count << std::endl;
- DeviceResetStarted(); // notify about device reset to be started
-
- // backup the device name
- std::string name = _backend->device_name ();
-
- std::cout << "AudioEngine::RESET::Stoping engine..." << std::endl;
- stop();
-
- std::cout << "AudioEngine::RESET::Reseting device..." << std::endl;
- if ( 0 == _backend->reset_device () ) {
-
- std::cout << "AudioEngine::RESET::Starting engine..." << std::endl;
- start ();
-
+ std::cout << "AudioEngine::RESET::Reset request processing. Requests left: " << _hw_reset_request_count << std::endl;
+ DeviceResetStarted(); // notify about device reset to be started
+
+ // backup the device name
+ std::string name = _backend->device_name ();
+
+ std::cout << "AudioEngine::RESET::Reseting device..." << std::endl;
+ if ( ( 0 == stop () ) &&
+ ( 0 == _backend->reset_device () ) &&
+ ( 0 == start () ) ) {
+
+ std::cout << "AudioEngine::RESET::Engine started..." << std::endl;
+
// inform about possible changes
BufferSizeChanged (_backend->buffer_size() );
- } else {
- DeviceError();
+ DeviceResetFinished(); // notify about device reset finish
+
+ } else {
+
+ DeviceResetFinished(); // notify about device reset finish
+ // we've got an error
+ DeviceError();
}
std::cout << "AudioEngine::RESET::Done." << std::endl;
@@ -522,6 +525,8 @@ AudioEngine::do_devicelist_update()
_devicelist_update_lock.unlock();
+ Glib::Threads::RecMutex::Lock pl (_state_lock);
+
g_atomic_int_dec_and_test (&_hw_devicelist_update_count);
DeviceListChanged (); /* EMIT SIGNAL */
@@ -623,9 +628,11 @@ AudioEngine::remove_session ()
void
AudioEngine::reconnect_session_routes (bool reconnect_inputs, bool reconnect_outputs)
{
- if (_session) {
- _session->reconnect_existing_routes(true, true, reconnect_inputs, reconnect_outputs);
- }
+#ifdef USE_TRACKS_CODE_FEATURES
+ if (_session) {
+ _session->reconnect_existing_routes(true, true, reconnect_inputs, reconnect_outputs);
+ }
+#endif
}
@@ -768,7 +775,7 @@ void
AudioEngine::drop_backend ()
{
if (_backend) {
- stop(false);
+ _backend->stop ();
_backend->drop_device ();
_backend.reset ();
_running = false;
@@ -856,18 +863,18 @@ AudioEngine::stop (bool for_latency)
return 0;
}
- if (_session && _running) {
+ if (_backend->stop ()) {
+ return -1;
+ }
+
+ if (_session && _running &&
+ (_session->state_of_the_state() & Session::Loading) == 0 &&
+ (_session->state_of_the_state() & Session::Deletion) == 0) {
// it's not a halt, but should be handled the same way:
// disable record, stop transport and I/O processign but save the data.
_session->engine_halted ();
}
- Glib::Threads::Mutex::Lock lm (_process_lock);
-
- if (_backend->stop ()) {
- return -1;
- }
-
_running = false;
_processed_frames = 0;
_measuring_latency = MeasureNone;
@@ -1151,6 +1158,12 @@ AudioEngine::set_systemic_output_latency (uint32_t ol)
return _backend->set_systemic_output_latency (ol);
}
+bool
+AudioEngine::thread_initialised_for_audio_processing ()
+{
+ return SessionEvent::has_per_thread_pool () && AsyncMIDIPort::is_process_thread();
+}
+
/* END OF BACKEND PROXY API */
void