Add action to noninteractively add BBT marker at playhead

This commit is contained in:
Robin Gareus 2022-12-02 21:31:56 +01:00
parent d808315e2a
commit b972301a3b
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 21 additions and 0 deletions

View File

@ -639,6 +639,9 @@ ARDOUR_UI::install_dependent_actions ()
act = ActionManager::register_action (common_actions, "alternate-remove-location-from-playhead", _("Remove Mark at Playhead"), sigc::mem_fun(editor, &PublicEditor::remove_location_at_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, "add-bbt-from-playhead", _("Add BBT Marker from Playhead"), sigc::mem_fun(editor, &PublicEditor::add_bbt_marker_at_playhead_cursor));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, "nudge-next-forward", _("Nudge Next Later"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_forward), true, false));
ActionManager::session_sensitive_actions.push_back (act);
act = ActionManager::register_action (common_actions, "nudge-next-backward", _("Nudge Next Earlier"), sigc::bind (sigc::mem_fun(editor, &PublicEditor::nudge_backward), true, false));

View File

@ -603,6 +603,7 @@ public:
void edit_tempo_section (Temporal::TempoPoint&);
void edit_meter_section (Temporal::MeterPoint&);
void mouse_add_bbt_marker_event (Temporal::timepos_t where);
void add_bbt_marker_at_playhead_cursor ();
void edit_bbt (Temporal::MusicTimePoint&);

View File

@ -528,6 +528,22 @@ Editor::mouse_add_new_meter_event (timepos_t pos)
tmc.map().set_meter (Meter (bpb, note_type), pos);
}
void
Editor::add_bbt_marker_at_playhead_cursor ()
{
if (_session == 0) {
return;
}
timepos_t pos (_session->transport_sample ());
BBT_Time bbt = Temporal::TempoMap::use()->bbt_at (pos);
std::string name = _("Playhead");
TempoMapChange tmc (*this, _("add BBT marker"));
tmc.map().set_bartime (bbt, pos, name);
}
void
Editor::mouse_add_bbt_marker_event (timepos_t pos)
{

View File

@ -247,6 +247,7 @@ public:
virtual void goto_nth_marker (int nth) = 0;
virtual void jump_to_loop_marker (bool start) = 0;
virtual void trigger_script (int nth) = 0;
virtual void add_bbt_marker_at_playhead_cursor () = 0;
virtual void add_location_from_playhead_cursor () = 0;
virtual void remove_location_at_playhead_cursor () = 0;
virtual void add_location_mark (Temporal::timepos_t const & where) = 0;