diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-19 12:39:15 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-19 13:05:54 +0100 |
commit | 0f020e59b8c5c6c63af2a3891ddb431e5d99bf12 (patch) | |
tree | d30788d901787ec258f69a953242d06a47d18ae3 /libs/ardour/session.cc | |
parent | 7939c2211c7f61a4d1779bbd07a73743cce10f91 (diff) |
Move preroll duration calc into libardour
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 27a3e63112..086edf2b45 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2105,6 +2105,22 @@ Session::audible_frame () const return std::max ((framepos_t)0, ret); } + +framecnt_t +Session::preroll_samples (framepos_t pos) const +{ + const float pr = Config->get_preroll_seconds(); + if (pos >= 0 && pr < 0) { + const Tempo& tempo = _tempo_map->tempo_at_frame (pos); + const Meter& meter = _tempo_map->meter_at_frame (pos); + return meter.frames_per_bar (tempo, frame_rate()) * -pr; + } + if (pr < 0) { + return 0; + } + return pr * frame_rate(); +} + void Session::set_frame_rate (framecnt_t frames_per_second) { |