diff options
author | Robin Gareus <robin@gareus.org> | 2017-01-17 20:43:55 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-01-17 20:43:55 +0100 |
commit | a6e02c0d71b67f3c571229c932dc20ee476df69b (patch) | |
tree | e92f501814d844e264164bfbb9fb0fbcad1f3a1e /libs/ardour/session_process.cc | |
parent | fcbed9c1dcb8490d35eeb274d8ef417c15ee7deb (diff) |
Implement Count-In (before recording), fixed BPM, up to 2 bars
Diffstat (limited to 'libs/ardour/session_process.cc')
-rw-r--r-- | libs/ardour/session_process.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index ad6ed1c16a..9be7007d19 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -314,6 +314,47 @@ Session::process_with_events (pframes_t nframes) process_event (ev); } + /* count in */ + if (_transport_speed != 1.0 && _count_in_samples > 0) { + _count_in_samples = 0; + } + + if (_count_in_samples > 0) { + framecnt_t ns = std::min ((framecnt_t)nframes, _count_in_samples); + + no_roll (ns); + run_click (_transport_frame - _count_in_samples, ns); + + _count_in_samples -= ns; + nframes -= ns; + + /* process events.. */ + if (!events.empty() && next_event != events.end()) { + SessionEvent* this_event = *next_event; + Events::iterator the_next_one = next_event; + ++the_next_one; + + while (this_event && this_event->action_frame == _transport_frame) { + process_event (this_event); + if (the_next_one == events.end()) { + this_event = 0; + } else { + this_event = *the_next_one; + ++the_next_one; + } + } + set_next_event (); + } + + check_declick_out (); + + if (nframes == 0) { + return; + } else { + _engine.split_cycle (ns); + } + } + /* Decide on what to do with quarter-frame MTC during this cycle */ bool const was_sending_qf_mtc = _send_qf_mtc; |