Promote the preroll_seconds config option to include musical time:
authorRobin Gareus <robin@gareus.org>
Wed, 18 Jan 2017 22:47:50 +0000 (23:47 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 18 Jan 2017 22:47:50 +0000 (23:47 +0100)
Interpret negative preroll time as bars

gtk2_ardour/editor_ops.cc
gtk2_ardour/rc_option_editor.cc

index 00234670ea1d0c073ad552bd270c6160d08bad24..6d78b9fac09b00c69eb46731c0e2c7046d1eeaff 100644 (file)
@@ -2609,17 +2609,16 @@ Editor::play_selection ()
 framepos_t
 Editor::get_preroll (framepos_t pos)
 {
-#if 0 // TODO: this needs a config option, or special case (e.g. negative get_preroll_seconds ())
-       if (pos >= 0) {
+       const float pr = Config->get_preroll_seconds();
+       if (pos >= 0 && pr < 0) {
                /* currently 1 bar's worth of pre-roll, not aligned to bar/beat
                 * to align to a bar before pos, see count_in, session_transport.cc
                 */
                const Tempo& tempo = _session->tempo_map().tempo_at_frame (pos);
                const Meter& meter = _session->tempo_map().meter_at_frame (pos);
-               return meter.frames_per_bar (tempo, _session->frame_rate());
+               return meter.frames_per_bar (tempo, _session->frame_rate()) * -pr;
        }
-#endif
-       return Config->get_preroll_seconds() * _session->frame_rate();
+       return pr * _session->frame_rate();
 }
 
 
index 316592dc129cb96e6b1d08abab74a69acd0bab14..4a5b0a8eefe81751c65c895addb17163b76166da 100644 (file)
@@ -2999,8 +2999,11 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (*_rc_config, &RCConfiguration::set_preroll_seconds)
                     );
        Gtkmm2ext::UI::instance()->set_tip (psc->tip_widget(),
-                                           (_("The amount of preroll (in seconds) to apply when <b>Play with Preroll</b> is initiated.\n\n"
+                                           (_("The amount of preroll to apply when <b>Play with Preroll</b> or <b>Record with Preroll</b>is initiated.\n\n"
                                               "If <b>Follow Edits</b> is enabled, the preroll is applied to the playhead position when a region is selected or trimmed.")));
+       psc->add (-4.0, _("4 Bars"));
+       psc->add (-2.0, _("2 Bars"));
+       psc->add (-1.0, _("1 Bar"));
        psc->add (0.0, _("0 (no pre-roll)"));
        psc->add (0.1, _("0.1 second"));
        psc->add (0.25, _("0.25 second"));