void request_preroll_record (framepos_t);
framepos_t preroll_record_in () const { return _preroll_record_in; }
bool preroll_record_enabled () const { return _preroll_record_in >= 0; }
+ framecnt_t preroll_samples (framepos_t) const;
/* temporary hacks to allow selection to be pushed from GUI into backend.
Whenever we move the selection object into libardour, these will go away.
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)
{