X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fsession_option_editor.cc;h=3e3cc61f0404aba2b0e2ee7b27adc9d7dabcf29e;hb=73fe0a3135da9ad43c1ee6fdb957b54c46a581d0;hp=29051fe09a7b61ed65e78f818879165425490ba3;hpb=bb9cc45cd22af67ac275a5e73accbe14fee664d8;p=ardour.git diff --git a/gtk2_ardour/session_option_editor.cc b/gtk2_ardour/session_option_editor.cc index 29051fe09a..3e3cc61f04 100644 --- a/gtk2_ardour/session_option_editor.cc +++ b/gtk2_ardour/session_option_editor.cc @@ -21,6 +21,7 @@ public: _ports[OURS].add_group (_port_group); setup_all_ports (); + init (); } void setup_ports (int dim) @@ -32,7 +33,7 @@ public: _port_group->add_bundle (_session.click_io()->bundle()); _port_group->add_bundle (_session.the_auditioner()->output()->bundle()); } else { - _ports[OTHER].gather (_session, true); + _ports[OTHER].gather (_session, true, false); } } @@ -138,9 +139,85 @@ private: }; SessionOptionEditor::SessionOptionEditor (Session* s) - : OptionEditor (&(s->config), _("Session Preferences")), - _session_config (&(s->config)) + : OptionEditor (&(s->config), _("Session Preferences")) + , _session_config (&(s->config)) { + /* SYNC */ + + ComboOption* spf = new ComboOption ( + "subframes-per-frame", + _("Subframes per frame"), + mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame), + mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame) + ); + + spf->add (80, _("80")); + spf->add (100, _("100")); + + add_option (_("Sync"), spf); + + ComboOption* ssrc = new ComboOption ( + "sync-source", + _("External sync source"), + mem_fun (*_session_config, &SessionConfiguration::get_sync_source), + mem_fun (*_session_config, &SessionConfiguration::set_sync_source) + ); + + s->MTC_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc)); + s->MIDIClock_PortChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::populate_sync_options), s, ssrc)); + s->config.ParameterChanged.connect (bind (mem_fun (*this, &SessionOptionEditor::follow_sync_state), s, ssrc)); + + populate_sync_options (s, ssrc); + follow_sync_state (string ("external-sync"), s, ssrc); + + add_option (_("Sync"), ssrc); + + ComboOption* smf = new ComboOption ( + "timecode-format", + _("Timecode frames-per-second"), + mem_fun (*_session_config, &SessionConfiguration::get_timecode_format), + mem_fun (*_session_config, &SessionConfiguration::set_timecode_format) + ); + + smf->add (timecode_23976, _("23.976")); + smf->add (timecode_24, _("24")); + smf->add (timecode_24976, _("24.976")); + smf->add (timecode_25, _("25")); + smf->add (timecode_2997, _("29.97")); + smf->add (timecode_2997drop, _("29.97 drop")); + smf->add (timecode_30, _("30")); + smf->add (timecode_30drop, _("30 drop")); + smf->add (timecode_5994, _("59.94")); + smf->add (timecode_60, _("60")); + + add_option (_("Sync"), smf); + + add_option (_("Sync"), new BoolOption ( + "timecode-source-is-synced", + _("Timecode source shares sample clock with audio interface"), + mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced), + mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced) + )); + + ComboOption* vpu = new ComboOption ( + "video-pullup", + _("Pull-up / pull-down"), + mem_fun (*_session_config, &SessionConfiguration::get_video_pullup), + mem_fun (*_session_config, &SessionConfiguration::set_video_pullup) + ); + + vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%")); + vpu->add (4.1667, _("4.1667")); + vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%")); + vpu->add (0.1, _("0.1")); + vpu->add (0, _("none")); + vpu->add (-0.1, _("-0.1")); + vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%")); + vpu->add (-4.1667, _("-4.1667")); + vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%")); + + add_option (_("Sync"), vpu); + /* FADES */ ComboOption* cfm = new ComboOption ( @@ -208,66 +285,6 @@ SessionOptionEditor::SessionOptionEditor (Session* s) mem_fun (*_session_config, &SessionConfiguration::set_show_region_fades) )); - /* SYNC */ - - ComboOption* spf = new ComboOption ( - "subframes-per-frame", - _("Subframes per frame"), - mem_fun (*_session_config, &SessionConfiguration::get_subframes_per_frame), - mem_fun (*_session_config, &SessionConfiguration::set_subframes_per_frame) - ); - - spf->add (80, _("80")); - spf->add (100, _("100")); - - add_option (_("Sync"), spf); - - ComboOption* smf = new ComboOption ( - "smpte-format", - _("Timecode frames-per-second"), - mem_fun (*_session_config, &SessionConfiguration::get_smpte_format), - mem_fun (*_session_config, &SessionConfiguration::set_smpte_format) - ); - - smf->add (smpte_23976, _("23.976")); - smf->add (smpte_24, _("24")); - smf->add (smpte_24976, _("24.976")); - smf->add (smpte_25, _("25")); - smf->add (smpte_2997, _("29.97")); - smf->add (smpte_2997drop, _("29.97 drop")); - smf->add (smpte_30, _("30")); - smf->add (smpte_30drop, _("30 drop")); - smf->add (smpte_5994, _("59.94")); - smf->add (smpte_60, _("60")); - - add_option (_("Sync"), smf); - - add_option (_("Sync"), new BoolOption ( - "timecode-source-is-synced", - _("Timecode source is synced"), - mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced), - mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced) - )); - - ComboOption* vpu = new ComboOption ( - "video-pullup", - _("Pull-up / pull-down"), - mem_fun (*_session_config, &SessionConfiguration::get_video_pullup), - mem_fun (*_session_config, &SessionConfiguration::set_video_pullup) - ); - - vpu->add (4.1667 + 0.1, _("4.1667 + 0.1%")); - vpu->add (4.1667, _("4.1667")); - vpu->add (4.1667 - 0.1, _("4.1667 - 0.1%")); - vpu->add (0.1, _("0.1")); - vpu->add (0, _("none")); - vpu->add (-0.1, _("-0.1")); - vpu->add (-4.1667 + 0.1, _("-4.1667 + 0.1%")); - vpu->add (-4.1667, _("-4.1667")); - vpu->add (-4.1667 - 0.1, _("-4.1667 - 0.1%")); - - add_option (_("Sync"), vpu); - /* MISC */ add_option (_("Misc"), new OptionEditorHeading (_("Audio file format"))); @@ -332,3 +349,30 @@ SessionOptionEditor::SessionOptionEditor (Session* s) add_option (_("Connections"), new ConnectionOptions (this, s)); } + +void +SessionOptionEditor::populate_sync_options (Session* s, Option* opt) +{ + ComboOption* sync_opt = dynamic_cast* > (opt); + + vector sync_opts = s->get_available_sync_options (); + + sync_opt->clear (); + + for (vector::iterator i = sync_opts.begin(); i != sync_opts.end(); ++i) { + sync_opt->add (*i, sync_source_to_string (*i)); + } +} + +void +SessionOptionEditor::follow_sync_state (std::string p, Session* s, Option* opt) +{ + ComboOption* sync_opt = dynamic_cast* > (opt); + if (p == "external-sync") { + if (s->config.get_external_sync()) { + sync_opt->set_sensitive (false); + } else { + sync_opt->set_sensitive (true); + } + } +}