diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 7ed03c9388..28c7decbb4 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -246,11 +246,11 @@ public: bool _in_destructor; Glib::Threads::Thread* _hw_reset_event_thread; - uint16_t _hw_reset_request_count; - bool _stop_hw_reset_processing; + gint _hw_reset_request_count; + gint _stop_hw_reset_processing; Glib::Threads::Thread* _hw_devicelist_update_thread; - uint16_t _hw_devicelist_update_count; - uint16_t _stop_hw_devicelist_processing; + gint _hw_devicelist_update_count; + gint _stop_hw_devicelist_processing; void start_hw_event_processing(); void stop_hw_event_processing(); diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index a1db5d8023..5ca08819a0 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -82,10 +82,10 @@ AudioEngine::AudioEngine () , _in_destructor (false) , _hw_reset_event_thread(0) , _hw_reset_request_count(0) - , _stop_hw_reset_processing(false) + , _stop_hw_reset_processing(0) , _hw_devicelist_update_thread(0) , _hw_devicelist_update_count(0) - , _stop_hw_devicelist_processing(false) + , _stop_hw_devicelist_processing(0) { g_atomic_int_set (&m_meter_exit, 0); start_hw_event_processing(); @@ -365,8 +365,7 @@ AudioEngine::process_callback (pframes_t nframes) void AudioEngine::request_backend_reset() { - //g_atomic_int_inc(&_hw_reset_request_count); - _hw_reset_request_count++; + g_atomic_int_inc(&_hw_reset_request_count); } @@ -379,8 +378,7 @@ AudioEngine::do_reset_backend() if (_hw_reset_request_count && _backend) { - //g_atomic_int_dec_and_test (&_hw_reset_request_count); - _hw_reset_request_count--; + g_atomic_int_dec_and_test (&_hw_reset_request_count); // backup the device name std::string name = _backend->device_name (); @@ -411,8 +409,7 @@ AudioEngine::do_reset_backend() void AudioEngine::request_device_list_update() { - //g_atomic_int_inc (&_hw_devicelist_update_count); - _hw_devicelist_update_count++; + g_atomic_int_inc (&_hw_devicelist_update_count); } @@ -423,8 +420,7 @@ AudioEngine::do_devicelist_update() while (!_stop_hw_devicelist_processing) { if (_hw_devicelist_update_count) { - //g_atomic_int_dec_and_test (&_hw_devicelist_update_count); - _hw_devicelist_update_count--; + g_atomic_int_dec_and_test (&_hw_devicelist_update_count); DeviceListChanged (); /* EMIT SIGNAL */ } g_usleep(0); @@ -436,18 +432,14 @@ void AudioEngine::start_hw_event_processing() { if (_hw_reset_event_thread == 0) { - //g_atomic_int_set(&_hw_reset_request_count, 0); - //g_atomic_int_set(&_stop_hw_reset_processing, 0); - _hw_reset_request_count = 0; - _stop_hw_reset_processing = 0; + g_atomic_int_set(&_hw_reset_request_count, 0); + g_atomic_int_set(&_stop_hw_reset_processing, 0); _hw_reset_event_thread = Glib::Threads::Thread::create (boost::bind (&AudioEngine::do_reset_backend, this)); } if (_hw_devicelist_update_thread == 0) { - //g_atomic_int_set(&_hw_devicelist_update_count, 0); - //g_atomic_int_set(&_stop_hw_devicelist_processing, 0); - _hw_devicelist_update_count = 0; - _stop_hw_devicelist_processing = 0; + g_atomic_int_set(&_hw_devicelist_update_count, 0); + g_atomic_int_set(&_stop_hw_devicelist_processing, 0); _hw_devicelist_update_thread = Glib::Threads::Thread::create (boost::bind (&AudioEngine::do_devicelist_update, this)); } } @@ -457,19 +449,15 @@ void AudioEngine::stop_hw_event_processing() { if (_hw_reset_event_thread) { - //g_atomic_int_set(&_stop_hw_reset_processing, 1); - //g_atomic_int_set(&_hw_reset_request_count, 0); - _stop_hw_reset_processing = 1; - _hw_reset_request_count = 0; + g_atomic_int_set(&_stop_hw_reset_processing, 1); + g_atomic_int_set(&_hw_reset_request_count, 0); _hw_reset_event_thread->join (); _hw_reset_event_thread = 0; } if (_hw_devicelist_update_thread) { - //g_atomic_int_set(&_stop_hw_devicelist_processing, 1); - //g_atomic_int_set(&_hw_devicelist_update_count, 0); - _stop_hw_devicelist_processing = 1; - _hw_devicelist_update_count = 0; + g_atomic_int_set(&_stop_hw_devicelist_processing, 1); + g_atomic_int_set(&_hw_devicelist_update_count, 0); _hw_devicelist_update_thread->join (); _hw_devicelist_update_thread = 0; }