diff --git a/gtk2_ardour/tracks_control_panel.logic.cc b/gtk2_ardour/tracks_control_panel.logic.cc index ae11282928..549e118bb8 100644 --- a/gtk2_ardour/tracks_control_panel.logic.cc +++ b/gtk2_ardour/tracks_control_panel.logic.cc @@ -1397,13 +1397,51 @@ TracksControlPanel::on_frame_rate_item_clicked (WavesDropdown*, int) void TracksControlPanel::on_buffer_size_dropdown_item_clicked (WavesDropdown*, int) { - show_buffer_duration(); + if (_ignore_changes) { + return; + } + + pframes_t new_buffer_size = get_buffer_size(); + if ( EngineStateController::instance()->set_new_buffer_size_in_controller(new_buffer_size) ) { + EngineStateController::instance()->push_current_state_to_backend (false); + + } else { + + // set _ignore_changes flag to ignore changes in combo-box callbacks + PBD::Unwinder protect_ignore_changes (_ignore_changes, _ignore_changes + 1); + // restore current buffer size value in combo box + std::string buffer_size_str = bufsize_as_string (EngineStateController::instance()->get_current_buffer_size() ); + WavesMessageDialog msg("", _("Buffer size set to the value which is not supported")); + msg.run(); + _buffer_size_dropdown.set_text(buffer_size_str); + } + + show_buffer_duration(); } void TracksControlPanel::on_sample_rate_dropdown_item_clicked (WavesDropdown*, int) { - show_buffer_duration(); + if (_ignore_changes) { + return; + } + + framecnt_t new_sample_rate = get_sample_rate (); + if ( EngineStateController::instance()->set_new_sample_rate_in_controller(new_sample_rate) ) { + EngineStateController::instance()->push_current_state_to_backend (false); + + } else { + + // set _ignore_changes flag to ignore changes in combo-box callbacks + PBD::Unwinder protect_ignore_changes (_ignore_changes, _ignore_changes + 1); + // restore current sample rate value in combo box + std::string sample_rate_str = ARDOUR_UI_UTILS::rate_as_string (EngineStateController::instance()->get_current_sample_rate() ); + WavesMessageDialog msg("", _("Sample rate set to the value which is not supported")); + msg.run(); + _sample_rate_dropdown.set_text(sample_rate_str); + } + + show_buffer_duration(); } void @@ -1598,32 +1636,6 @@ TracksControlPanel::on_ok (WavesButton*) void TracksControlPanel::accept () { - framecnt_t new_sample_rate = get_sample_rate (); - if ( ! EngineStateController::instance()->set_new_sample_rate_in_controller(new_sample_rate) ) - { - // restore current sample rate value in combo box - std::string sample_rate_str = ARDOUR_UI_UTILS::rate_as_string (EngineStateController::instance()->get_current_sample_rate() ); - WavesMessageDialog msg("", _("Sample rate set to the value which is not supported")); - msg.run(); - _sample_rate_dropdown.set_text(sample_rate_str); - show_buffer_duration(); - return; - } - - pframes_t new_buffer_size = get_buffer_size(); - if ( ! EngineStateController::instance()->set_new_buffer_size_in_controller(new_buffer_size) ) - { - // restore current buffer size value in combo box - std::string buffer_size_str = bufsize_as_string (EngineStateController::instance()->get_current_buffer_size() ); - WavesMessageDialog msg("", _("Buffer size set to the value which is not supported")); - msg.run(); - _buffer_size_dropdown.set_text(buffer_size_str); - show_buffer_duration(); - return; - } - - - EngineStateController::instance()->push_current_state_to_backend(true); response(Gtk::RESPONSE_OK); update_configs(); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index d53f32e315..14c9bdcf46 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1782,6 +1782,8 @@ Session::set_frame_rate (framecnt_t frames_per_second) _base_frame_rate = frames_per_second; _nominal_frame_rate = frames_per_second; + ARDOUR::EngineStateController::instance()->set_desired_sample_rate (frames_per_second); + sync_time_vars(); clear_clicks ();