Move some sync-related options to being session variables.
authorCarl Hetherington <carl@carlh.net>
Sat, 16 May 2009 01:53:43 +0000 (01:53 +0000)
committerCarl Hetherington <carl@carlh.net>
Sat, 16 May 2009 01:53:43 +0000 (01:53 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5083 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/editor_actions.cc
gtk2_ardour/session_option_editor.cc
libs/ardour/ardour/rc_configuration_vars.h
libs/ardour/ardour/session_configuration_vars.h
libs/ardour/audioengine.cc
libs/ardour/session.cc
libs/ardour/session_state.cc
libs/ardour/session_time.cc
libs/ardour/session_transport.cc

index 2216038558378de25a7b07fd7e5cf333b3664a48..882a1f2b87e4a206aadb0621a233f60d86191034 100644 (file)
@@ -46,7 +46,7 @@ using namespace sigc;
 void
 ARDOUR_UI::toggle_time_master ()
 {
-       ActionManager::toggle_config_state ("Transport", "ToggleTimeMaster", &RCConfiguration::set_jack_time_master, &RCConfiguration::get_jack_time_master);
+       ActionManager::toggle_config_state_foo ("Transport", "ToggleTimeMaster", mem_fun (session->config, &SessionConfiguration::set_jack_time_master), mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
 }
 
 void
@@ -461,7 +461,7 @@ ARDOUR_UI::toggle_video_sync()
        Glib::RefPtr<Action> act = ActionManager::get_action ("Transport", "ToggleVideoSync");
        if (act) {
                Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
-               Config->set_use_video_sync (tact->get_active());
+               session->config.set_use_video_sync (tact->get_active());
        }
 }
 
@@ -1153,7 +1153,7 @@ ARDOUR_UI::parameter_changed (std::string p)
        } else if (p == "clicking") {
                ActionManager::map_some_state ("Transport", "ToggleClick", &RCConfiguration::get_clicking);
        } else if (p == "jack-time-master") {
-               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", &RCConfiguration::get_jack_time_master);
+               ActionManager::map_some_state ("Transport",  "ToggleTimeMaster", mem_fun (session->config, &SessionConfiguration::get_jack_time_master));
        } else if (p == "plugins-stop-with-transport") {
                ActionManager::map_some_state ("options",  "StopPluginsWithTransport", &RCConfiguration::get_plugins_stop_with_transport);
        } else if (p == "new-plugins-active") {
@@ -1181,7 +1181,7 @@ ARDOUR_UI::parameter_changed (std::string p)
        } else if (p == "remote-model") {
                map_remote_model ();
        } else if (p == "use-video-sync") {
-               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", &RCConfiguration::get_use_video_sync);
+               ActionManager::map_some_state ("Transport",  "ToggleVideoSync", mem_fun (session->config, &SessionConfiguration::get_use_video_sync));
        } else if (p == "quieten-at-speed") {
                ActionManager::map_some_state ("options",  "GainReduceFastTransport", &RCConfiguration::get_quieten_at_speed);
        } else if (p == "shuttle-behaviour") {
index a53a1c7490de55fd8dbe11232add3b8a7f77760e..28110c685fa70cab14203c985b6d6fe4ef1deb24 100644 (file)
@@ -509,7 +509,7 @@ AudioClock::set_frames (nframes_t when, bool force)
                        frames_upper_info_label->set_text (buf);
                }
                
-               float vid_pullup = Config->get_video_pullup();
+               float vid_pullup = session->config.get_video_pullup();
                
                if (vid_pullup == 0.0) {
                        if (frames_lower_info_label->get_text () != _("none")) {
index b276b57f2aa0df21fd6061bbb924a7eab0f4f3aa..91bf421d4444b75bbb77a6fd2bdb45edf97d64b2 100644 (file)
@@ -1123,7 +1123,7 @@ Editor::update_video_pullup ()
        RefPtr<Action> act;
        const char* action = 0;
 
-       float pullup = Config->get_video_pullup();
+       float pullup = session->config.get_video_pullup();
 
        if ( pullup < (-4.1667 - 0.1) * 0.99) {
                action = X_("PullupMinus4Minus1");
@@ -1656,7 +1656,7 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup)
        if (act) {
                RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
                if (ract && ract->get_active()) {
-                       Config->set_video_pullup ( pull );
+                       session->config.set_video_pullup ( pull );
                }
                
        } else  {
index 6c05794ed142a37122f3f793f1c609d29dbf97dd..5aea3b5a7fee6f6cfcee1fd9061abcf36e3c4730 100644 (file)
@@ -116,6 +116,25 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
                            mem_fun (*_session_config, &SessionConfiguration::get_timecode_source_is_synced),
                            mem_fun (*_session_config, &SessionConfiguration::set_timecode_source_is_synced)
                            ));
+
+       ComboOption<float>* vpu = new ComboOption<float> (
+               "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 */
 
index f90cde88c346e41977a54f3d0c889cd1bb468289..7f319cf2b2e550549b14428a185f178c4b585243 100644 (file)
@@ -113,12 +113,6 @@ CONFIG_VARIABLE (bool, secondary_clock_delta_edit_cursor, "secondary-clock-delta
 CONFIG_VARIABLE (bool, show_track_meters, "show-track-meters", true)
 CONFIG_VARIABLE (bool, locate_while_waiting_for_sync, "locate-while-waiting-for-sync", false)
 
-/* timecode and sync */
-
-CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true)
-CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false)
-CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f)
-
 /* metering */
 
 CONFIG_VARIABLE (float, meter_hold, "meter-hold", 100.0f)
index d99fc031d81ef605d48a19097336b9e23faf13b5..51dbc3dad90564dc25d65ce81682134884a85e39 100644 (file)
@@ -42,3 +42,6 @@ CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", MoveAddHigher)
 CONFIG_VARIABLE (std::string, auditioner_output_left, "auditioner-output-left", "default")
 CONFIG_VARIABLE (std::string, auditioner_output_right, "auditioner-output-right", "default")
 CONFIG_VARIABLE (bool, timecode_source_is_synced, "timecode-source-is-synced", true)
+CONFIG_VARIABLE (bool, jack_time_master, "jack-time-master", true)
+CONFIG_VARIABLE (bool, use_video_sync, "use-video-sync", false)
+CONFIG_VARIABLE (float, video_pullup, "video-pullup", 0.0f)
index 3e1ba8b2d9decda1ac82b08f2174b8056658fa85..1dc646b6100d020c5848d0482a3bd36dc406c999 100644 (file)
@@ -178,7 +178,7 @@ AudioEngine::start ()
                jack_set_sync_callback (_jack, _jack_sync_callback, this);
                jack_set_freewheel_callback (_jack, _freewheel_callback, this);
 
-               if (Config->get_jack_time_master()) {
+               if (session && session->config.get_jack_time_master()) {
                        jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this);
                }
 
@@ -1090,8 +1090,8 @@ AudioEngine::transport_state ()
 int
 AudioEngine::reset_timebase ()
 {
-       if (_jack) {
-               if (Config->get_jack_time_master()) {
+       if (_jack && session) {
+               if (session->config.get_jack_time_master()) {
                        return jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this);
                } else {
                        return jack_release_timebase (_jack);
@@ -1285,7 +1285,7 @@ AudioEngine::reconnect_to_jack ()
        jack_set_sync_callback (_jack, _jack_sync_callback, this);
        jack_set_freewheel_callback (_jack, _freewheel_callback, this);
        
-       if (Config->get_jack_time_master()) {
+       if (session && session->config.get_jack_time_master()) {
                jack_set_timebase_callback (_jack, 0, _jack_timebase_callback, this);
        } 
        
index bd2038414450b4bbe0482c39e9ddd0a8f02b2a69..eebde5ffa777731f841b3beeca5973050cb6d7df 100644 (file)
@@ -543,7 +543,7 @@ Session::when_engine_running ()
                _engine.transport_stop ();
        }
 
-       if (Config->get_jack_time_master()) {
+       if (config.get_jack_time_master()) {
                _engine.transport_locate (_transport_frame);
        }
 
index 6af308a9b88938df106323ed675dd22d4b2dfe46..4d07a6c6e26db883651860a941ef68e0e61456e4 100644 (file)
@@ -230,7 +230,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
 
        process_function = &Session::process_with_events;
 
-       if (Config->get_use_video_sync()) {
+       if (config.get_use_video_sync()) {
                waiting_for_sync_offset = true;
        } else {
                waiting_for_sync_offset = false;
@@ -3062,7 +3062,7 @@ Session::config_changed (std::string p, bool ours)
 
        } else if (p == "use-video-sync") {
 
-               waiting_for_sync_offset = Config->get_use_video_sync();
+               waiting_for_sync_offset = config.get_use_video_sync();
 
        } else if (p == "mmc-control") {
 
index 223c30bd1a3dc8d8c9995fd84a9f52f895b1f7c2..4e4c066ba4befdd478cd6d81a76d3bf3730b423d 100644 (file)
@@ -150,7 +150,7 @@ Session::smpte_drop_frames() const
 void
 Session::sync_time_vars ()
 {
-       _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (Config->get_video_pullup()/100.0)));
+       _current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
        _frames_per_smpte_frame = (double) _current_frame_rate / (double) smpte_frames_per_second();
        if (smpte_drop_frames()) {
          _frames_per_hour = (long)(107892 * _frames_per_smpte_frame);
index ccdbbb3ef6d55cc0525673b354b35939a7e140fa..b3fa34419a62c5e2d4a925bcec098d7123ab78b7 100644 (file)
@@ -180,7 +180,7 @@ Session::realtime_stop (bool abort)
        target_phi = 0;
        phase = 0;
 
-       if (Config->get_use_video_sync()) {
+       if (config.get_use_video_sync()) {
                waiting_for_sync_offset = true;
        }