diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-18 23:47:50 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-18 23:47:50 +0100 |
commit | ef64c7ba19e2908e27fbcdb4ba536b7e0e173371 (patch) | |
tree | 42101a68bea059b5561745538cc8429f9abb33a8 /gtk2_ardour/editor_ops.cc | |
parent | d650b3c29208ea57a24618e13f4787b74476f908 (diff) |
Promote the preroll_seconds config option to include musical time:
Interpret negative preroll time as bars
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 00234670ea..6d78b9fac0 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -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(); } |