diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index f27ddb0fe2..7853ddb34e 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -215,7 +215,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) , _hd_remained_time_label(0) , editor (0) , mixer (0) - //, meterbridge (0) + , _bit_depth_button(0) + , _sample_rate_button(0) + , _frame_rate_button(0) , splash (0) { Gtkmm2ext::init(localedir); @@ -313,6 +315,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir) ARDOUR::GUIIdle.connect (forever_connections, MISSING_INVALIDATOR, boost::bind(&ARDOUR_UI::gui_idle_handler, this), gui_context()); + EngineStateController::instance()->SampleRateChanged.connect_same_thread (update_connections_to_toolbar_buttons, boost::bind (&ARDOUR_UI::update_sample_rate_button, this) ); + EngineStateController::instance()->EngineRunning.connect_same_thread (update_connections_to_toolbar_buttons, boost::bind (&ARDOUR_UI::update_sample_rate_button, this) ); + /* lets get this party started */ setup_gtk_ardour_enums (); diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 2e62eef7c2..3c2233b025 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -227,6 +227,17 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr void focus_on_clock (); AudioClock* big_clock; + WavesButton* _bit_depth_button; + WavesButton* _sample_rate_button; + WavesButton* _frame_rate_button; + void on_bit_depth_button (WavesButton*); + void on_sample_rate_button (WavesButton*); + void on_frame_rate_button (WavesButton*); + void update_bit_depth_button (); + void update_sample_rate_button (); + void update_frame_rate_button (); + PBD::ScopedConnectionList update_connections_to_toolbar_buttons; + TimeInfoBox* time_info_box; VideoTimeLine *video_timeline; diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 1edee56d1d..2564639a25 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -231,6 +231,10 @@ ARDOUR_UI::set_session (Session *s) editor_meter_peak_display.show(); } } + + update_bit_depth_button (); + update_sample_rate_button (); + update_frame_rate_button (); } int diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index b86620ed87..36208c2c19 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -67,6 +67,7 @@ #include "control_protocol/control_protocol.h" #include "i18n.h" +#include "utils.h" using namespace std; using namespace ARDOUR; @@ -86,11 +87,19 @@ ARDOUR_UI::create_editor () _dsp_load_label = &editor->get_label("dsp_load_label"); _hd_load_label = &editor->get_label("hd_load_label"); _hd_remained_time_label = &editor->get_label("hd_remained_time"); - } + + _bit_depth_button = &editor->get_waves_button("bit_depth_button"); + _sample_rate_button = &editor->get_waves_button("sample_rate_button"); + _frame_rate_button = &editor->get_waves_button("frame_rate_button"); + } catch (failed_constructor& err) { return -1; } + + _bit_depth_button->signal_clicked.connect(sigc::mem_fun (*this, &ARDOUR_UI::on_bit_depth_button)); + _sample_rate_button->signal_clicked.connect(sigc::mem_fun (*this, &ARDOUR_UI::on_sample_rate_button)); + _frame_rate_button->signal_clicked.connect(sigc::mem_fun (*this, &ARDOUR_UI::on_frame_rate_button)); editor->Realized.connect (sigc::mem_fun (*this, &ARDOUR_UI::editor_realized)); editor->signal_window_state_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::main_window_state_event_handler), true)); @@ -98,6 +107,85 @@ ARDOUR_UI::create_editor () return 0; } +void +ARDOUR_UI::on_bit_depth_button (WavesButton*) +{ + tracks_control_panel->show (); +} + +void +ARDOUR_UI::on_sample_rate_button (WavesButton*) +{ + tracks_control_panel->show (); +} + +void +ARDOUR_UI::on_frame_rate_button (WavesButton*) +{ + tracks_control_panel->show (); +} + +void +ARDOUR_UI::update_bit_depth_button () +{ + if( _session && _bit_depth_button ) + { + string file_data_format; + switch (_session->config.get_native_file_data_format ()) { + case FormatFloat: + file_data_format = "32 bit"; + break; + case FormatInt24: + file_data_format = "24 bit"; + break; + case FormatInt16: + file_data_format = "16 bit"; + break; + } + _bit_depth_button->set_text (file_data_format); + } +} + +void +ARDOUR_UI::update_sample_rate_button () +{ + if( !_sample_rate_button ) + return; + + std::string active_sr = rate_as_string(EngineStateController::instance()->get_current_sample_rate()); + _sample_rate_button->set_text (active_sr); +} + +void +ARDOUR_UI::update_frame_rate_button () +{ + if( !_frame_rate_button ) + return; + + string timecode_format_string; + switch( _timecode_format ) { + case Timecode::timecode_24: + timecode_format_string = "24 fps"; + break; + case Timecode::timecode_25: + timecode_format_string = "25 fps"; + break; + case Timecode::timecode_30: + timecode_format_string = "30 fps"; + break; + case Timecode::timecode_23976: + timecode_format_string = "23.976 fps"; + break; + case Timecode::timecode_2997: + timecode_format_string = "29.97 fps"; + break; + default: + break; + } + + _frame_rate_button->set_text (timecode_format_string); +} + void ARDOUR_UI::install_actions () { diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index be649951f0..160dc360c9 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -418,10 +418,20 @@ ARDOUR_UI::parameter_changed (std::string p) void ARDOUR_UI::session_parameter_changed (const std::string& param) { - if (param == "native-file-data-format" || param == "native-file-header-format") + if ( param == "native-file-data-format" ) + { update_format(); - if ( param == "timecode-format") + update_bit_depth_button (); + } + else if (param == "native-file-header-format") + { + update_format(); + } + else if ( param == "timecode-format" ) + { update_timecode_format(); + update_frame_rate_button (); + } } void diff --git a/gtk2_ardour/ui/editor_window.xml b/gtk2_ardour/ui/editor_window.xml index 650a49c8cf..c2e2c45e3c 100644 --- a/gtk2_ardour/ui/editor_window.xml +++ b/gtk2_ardour/ui/editor_window.xml @@ -32,15 +32,51 @@ normalicon="tracks" activeicon="tracks_active" prelighticon="tracks_prelight"/> + - + + +