diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-18 15:16:05 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-18 15:16:05 +0100 |
commit | 645402bc42879364a16c0d6c230e9125bd0aeb1f (patch) | |
tree | ba7a9e632575466f2221ec5441e3d5b9dfdeeda3 | |
parent | efd10abdfb54bb1dd56de0aa01278805f5fbf332 (diff) |
Add GUI action to record with preroll
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/public_editor.h | 1 |
7 files changed, 31 insertions, 0 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index 7d18d17d11..b579e7d2a1 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -74,6 +74,7 @@ <menuitem action='record-roll'/> <menuitem action='ToggleRollForgetCapture'/> <menuitem action='Record'/> + <menuitem action='RecordPreroll'/> #if 0 <menuitem action='toggle-skip-playback'/> #endif diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 46510112b7..d9ea44c325 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2450,6 +2450,15 @@ ARDOUR_UI::transport_play_preroll () } void +ARDOUR_UI::transport_rec_preroll () +{ + if (!_session) { + return; + } + editor->rec_with_preroll (); +} + +void ARDOUR_UI::transport_rewind (int option) { float current_transport_speed; diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 5686d8c978..f69a4a3dd6 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -677,6 +677,7 @@ private: void transport_roll (); void transport_play_selection(); void transport_play_preroll(); + void transport_rec_preroll(); void transport_forward (int option); void transport_rewind (int option); void transport_loop (); diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 2c21de6074..1cdbcb51c7 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -408,6 +408,10 @@ ARDOUR_UI::install_actions () ActionManager::session_sensitive_actions.push_back (act); ActionManager::transport_sensitive_actions.push_back (act); + act = global_actions.register_action (transport_actions, X_("RecordPreroll"), _("Record w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_rec_preroll)); + ActionManager::session_sensitive_actions.push_back (act); + ActionManager::write_sensitive_actions.push_back (act); + act = global_actions.register_action (transport_actions, X_("Record"), _("Enable Record"), sigc::bind (sigc::mem_fun(*this, &ARDOUR_UI::transport_record), false)); ActionManager::session_sensitive_actions.push_back (act); ActionManager::write_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index dfe25420f6..d34a40cda8 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -264,6 +264,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD framepos_t get_preroll (); void maybe_locate_with_edit_preroll (framepos_t); void play_with_preroll (); + void rec_with_preroll (); void select_all_in_track (Selection::Operation op); void select_all_objects (Selection::Operation op); void invert_selection_in_track (); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 633a6989d8..95be0ed972 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2666,6 +2666,20 @@ Editor::play_with_preroll () } void +Editor::rec_with_preroll () +{ + framepos_t preroll = get_preroll(); + framepos_t ph = playhead_cursor->current_frame (); + framepos_t start = std::max ((framepos_t)0, ph - preroll); + + _session->request_preroll_record (ph); + _session->maybe_enable_record (); + _session->request_locate (start, true); + _session->set_requested_return_frame (ph); +} + + +void Editor::play_location (Location& location) { if (location.start() <= location.end()) { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 4220ddbb72..cdae2480ec 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -211,6 +211,7 @@ class PublicEditor : public Gtkmm2ext::Tabbable { virtual bool extend_selection_to_track (TimeAxisView&) = 0; virtual void play_selection () = 0; virtual void play_with_preroll () = 0; + virtual void rec_with_preroll () = 0; virtual void maybe_locate_with_edit_preroll (framepos_t location) = 0; virtual void goto_nth_marker (int nth) = 0; virtual void trigger_script (int nth) = 0; |