configurable subframes-per-frame, defaults to 80
git-svn-id: svn://localhost/ardour2/trunk@1143 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
aa0fee1e8d
commit
ec588a28ba
|
@ -258,6 +258,10 @@
|
|||
<menuitem action='PullupMinus4'/>
|
||||
<menuitem action='PullupMinus4Minus1'/>
|
||||
</menu>
|
||||
<menu action='Subframes'>
|
||||
<menuitem action='Subframes80'/>
|
||||
<menuitem action='Subframes100'/>
|
||||
</menu>
|
||||
<separator/>
|
||||
<menu action='Autoconnect'>
|
||||
<menuitem action='InputAutoConnectPhysical'/>
|
||||
|
|
|
@ -295,10 +295,11 @@ class Editor : public PublicEditor
|
|||
|
||||
void smpte_fps_chosen (ARDOUR::Session::SmpteFormat format);
|
||||
void video_pullup_chosen (ARDOUR::Session::PullupFormat pullup);
|
||||
void subframes_per_frame_chosen (uint32_t);
|
||||
|
||||
void update_smpte_mode();
|
||||
void update_video_pullup();
|
||||
|
||||
void update_subframes_per_frame ();
|
||||
/* xfades */
|
||||
|
||||
void toggle_auto_xfade ();
|
||||
|
|
|
@ -42,6 +42,7 @@ Editor::register_actions ()
|
|||
ActionManager::register_action (editor_actions, X_("Layering"), _("Layering"));
|
||||
ActionManager::register_action (editor_actions, X_("Timecode"), _("Timecode fps"));
|
||||
ActionManager::register_action (editor_actions, X_("Pullup"), _("Pullup / Pulldown"));
|
||||
ActionManager::register_action (editor_actions, X_("Subframes"), _("Subframes"));
|
||||
ActionManager::register_action (editor_actions, X_("addExistingAudioFiles"), _("Add Existing Audio"));
|
||||
|
||||
/* add named actions for the editor */
|
||||
|
@ -402,6 +403,11 @@ Editor::register_actions ()
|
|||
ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4"), _("-4.1667%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4));
|
||||
ActionManager::register_radio_action (editor_actions, pullup_group, X_("PullupMinus4Minus1"), _("-4.1667% - 0.1%"), bind (mem_fun (*this, &Editor::video_pullup_chosen), Session::pullup_Minus4Minus1));
|
||||
|
||||
RadioAction::Group subframe_group;
|
||||
|
||||
ActionManager::register_radio_action (editor_actions, pullup_group, X_("Subframes80"), _("80 per frame"), bind (mem_fun (*this, &Editor::subframes_per_frame_chosen), 80));
|
||||
ActionManager::register_radio_action (editor_actions, pullup_group, X_("Subframes100"), _("100 per frame"), bind (mem_fun (*this, &Editor::subframes_per_frame_chosen), 100));
|
||||
|
||||
ActionManager::add_action_group (rl_actions);
|
||||
ActionManager::add_action_group (zoom_actions);
|
||||
ActionManager::add_action_group (mouse_mode_actions);
|
||||
|
@ -978,6 +984,70 @@ Editor::video_pullup_chosen (Session::PullupFormat pullup)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::update_subframes_per_frame ()
|
||||
{
|
||||
ENSURE_GUI_THREAD (mem_fun(*this, &Editor::update_subframes_per_frame));
|
||||
|
||||
RefPtr<Action> act;
|
||||
const char* action = 0;
|
||||
|
||||
uint32_t sfpf = Config->get_subframes_per_frame();
|
||||
|
||||
if (sfpf == 80) {
|
||||
action = X_("Subframes80");
|
||||
} else if (sfpf == 100) {
|
||||
action = X_("Subframes100");
|
||||
} else {
|
||||
warning << string_compose (_("Configuraton is using unhandled subframes per frame value: %1"), sfpf) << endmsg;
|
||||
/*NOTREACHED*/
|
||||
return;
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Editor"), action);
|
||||
|
||||
if (act) {
|
||||
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
|
||||
if (ract && !ract->get_active()) {
|
||||
ract->set_active (true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::subframes_per_frame_chosen (uint32_t sfpf)
|
||||
{
|
||||
/* this is driven by a toggle on a radio group, and so is invoked twice,
|
||||
once for the item that became inactive and once for the one that became
|
||||
active.
|
||||
*/
|
||||
|
||||
const char* action = 0;
|
||||
|
||||
RefPtr<Action> act;
|
||||
|
||||
if (sfpf == 80) {
|
||||
action = X_("Subframes80");
|
||||
} else if (sfpf == 100) {
|
||||
action = X_("Subframes100");
|
||||
} else {
|
||||
fatal << string_compose (_("programming error: %1 %2"), "Session received unexpected subframes per frame value: ", sfpf) << endmsg;
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
act = ActionManager::get_action (X_("Editor"), action);
|
||||
|
||||
if (act) {
|
||||
RefPtr<RadioAction> ract = RefPtr<RadioAction>::cast_dynamic(act);
|
||||
if (ract && ract->get_active()) {
|
||||
Config->set_subframes_per_frame ((uint32_t) rint (sfpf));
|
||||
}
|
||||
|
||||
} else {
|
||||
error << string_compose (_("programming error: %1"), "Editor::subframes_per_frame_chosen could not find action to match value.") << endmsg;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Editor::toggle_auto_xfade ()
|
||||
{
|
||||
|
@ -1026,6 +1096,8 @@ Editor::parameter_changed (const char* parameter_name)
|
|||
update_crossfade_model ();
|
||||
} else if (PARAM_IS ("edit-mode")) {
|
||||
edit_mode_selector.set_active_text (edit_mode_to_string (Config->get_edit_mode()));
|
||||
} else if (PARAM_IS ("subframes_per_frame")) {
|
||||
update_subframes_per_frame ();
|
||||
}
|
||||
|
||||
#undef PARAM_IS
|
||||
|
|
|
@ -119,6 +119,7 @@ CONFIG_VARIABLE (bool, hiding_groups_deactivates_groups, "hiding-groups-deactiva
|
|||
CONFIG_VARIABLE (bool, verify_remove_last_capture, "verify-remove-last-capture", true)
|
||||
CONFIG_VARIABLE (bool, no_new_session_dialog, "no-new-session-dialog", false)
|
||||
CONFIG_VARIABLE (bool, use_vst, "use-vst", true)
|
||||
CONFIG_VARIABLE (uint32_t, subframes_per_frame, "subframes-per-frame", 100)
|
||||
|
||||
/* BWAV */
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ Session::smpte_to_sample( SMPTE::Time& smpte, nframes_t& sample, bool use_offset
|
|||
}
|
||||
|
||||
if (use_subframes) {
|
||||
sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / 80.0);
|
||||
sample += (long) (((double)smpte.subframes * _frames_per_smpte_frame) / Config->get_subframes_per_frame());
|
||||
}
|
||||
|
||||
if (use_offset) {
|
||||
|
@ -224,10 +224,10 @@ Session::sample_to_smpte( nframes_t sample, SMPTE::Time& smpte, bool use_offset,
|
|||
// Calculate exact number of (exceeding) smpte frames and fractional frames
|
||||
smpte_frames_left_exact = (double) offset_sample / _frames_per_smpte_frame;
|
||||
smpte_frames_fraction = smpte_frames_left_exact - floor( smpte_frames_left_exact );
|
||||
smpte.subframes = (long) rint(smpte_frames_fraction * 80.0);
|
||||
smpte.subframes = (long) rint(smpte_frames_fraction * Config->get_subframes_per_frame());
|
||||
|
||||
// XXX Not sure if this is necessary anymore...
|
||||
if (smpte.subframes == 80) {
|
||||
if (smpte.subframes == Config->get_subframes_per_frame()) {
|
||||
// This can happen with 24 fps (and 29.97 fps ?)
|
||||
smpte_frames_left_exact = ceil( smpte_frames_left_exact );
|
||||
smpte.subframes = 0;
|
||||
|
|
Loading…
Reference in New Issue