[Summary] Made sample rate and buffer size changed instantly

This commit is contained in:
GZharun 2015-02-28 20:57:58 +02:00
parent b9889bf4bc
commit 5d7de60ae8
2 changed files with 42 additions and 28 deletions

View file

@ -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<uint32_t> 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<uint32_t> 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();

View file

@ -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 ();