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);
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;
_devicelist_update_lock.unlock();
+ Glib::Threads::RecMutex::Lock pl (_state_lock);
+
g_atomic_int_dec_and_test (&_hw_devicelist_update_count);
DeviceListChanged (); /* EMIT SIGNAL */
AudioEngine::drop_backend ()
{
if (_backend) {
- stop(false);
+ _backend->stop ();
_backend->drop_device ();
_backend.reset ();
_running = false;
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;