Move preroll duration calc into libardour
This commit is contained in:
parent
7939c2211c
commit
0f020e59b8
@ -1001,6 +1001,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
||||
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.
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user