From eded0c06cdbd0092254e69128639292e092a093e Mon Sep 17 00:00:00 2001 From: GZharun Date: Sat, 7 Feb 2015 21:39:43 +0200 Subject: [PATCH] [Summary] Fixed bug with sample rate dropping to previous value when new session is created --- libs/ardour/engine_state_controller.cc | 4 ++-- libs/ardour/session.cc | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/ardour/engine_state_controller.cc b/libs/ardour/engine_state_controller.cc index 575b40751b..dc67e4b10d 100644 --- a/libs/ardour/engine_state_controller.cc +++ b/libs/ardour/engine_state_controller.cc @@ -1333,7 +1333,7 @@ EngineStateController::_on_session_loaded () _session->reconnect_mmc_ports (true); _session->reconnect_mmc_ports (false); - if (_session && _desired_sample_rate && set_new_sample_rate_in_controller(_desired_sample_rate) ) + if (_desired_sample_rate > 0 && set_new_sample_rate_in_controller(_desired_sample_rate) ) { push_current_state_to_backend(false); SampleRateChanged(); // emit a signal @@ -1770,7 +1770,7 @@ EngineStateController::push_current_state_to_backend(bool start) void EngineStateController::set_desired_sample_rate(framecnt_t session_desired_sr) { - if (session_desired_sr == 0 || session_desired_sr == _desired_sample_rate) { + if (session_desired_sr < 0) { return; } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 336a8cef5f..020c785841 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -306,6 +306,9 @@ Session::Session (AudioEngine &eng, pre_engine_init (fullpath); if (_is_new) { + + sr = EngineStateController::instance()->get_current_sample_rate(); + if (ensure_engine (sr)) { destroy (); throw failed_constructor ();