Move some sync-related options to being session variables.

git-svn-id: svn://localhost/ardour2/branches/3.0@5083 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-05-16 01:53:43 +00:00
parent 29e8fe1698
commit 86dda29be7
11 changed files with 38 additions and 22 deletions

View 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") {

View 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")) {

View 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 {

View 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 */

View 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)

View 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)

View 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);
}

View 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);
}

View 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") {

View 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);

View 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;
}