assert (_count_in_samples == 0 || _remaining_latency_preroll == 0 || _count_in_samples == _remaining_latency_preroll);
- if (_count_in_samples > 0 || _remaining_latency_preroll > 0) {
+ while (_count_in_samples > 0 || _remaining_latency_preroll > 0) {
samplecnt_t ns;
if (_remaining_latency_preroll > 0) {
ns = std::min ((samplecnt_t)nframes, _count_in_samples);
}
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ samplecnt_t route_offset = (*i)->playback_latency ();
+ if (_remaining_latency_preroll > route_offset + ns) {
+ /* route will no-roll for complete pre-roll cycle */
+ continue;
+ }
+ if (_remaining_latency_preroll > route_offset) {
+ /* route may need partial no-roll and partial roll from
+ * (_transport_sample - _remaining_latency_preroll) .. +ns.
+ * shorten and split the cycle.
+ */
+ ns = std::min (ns, (_remaining_latency_preroll - route_offset));
+ }
+ }
+
if (_count_in_samples > 0) {
run_click (_transport_sample - _count_in_samples, ns);
assert (_count_in_samples >= ns);
}
}
- if (_transport_speed == 1.0) {
- samples_moved = (samplecnt_t) nframes;
- } else {
- interpolation.set_target_speed (_target_transport_speed);
- interpolation.set_speed (_transport_speed);
- samples_moved = (samplecnt_t) interpolation.interpolate (0, nframes, 0, 0);
- }
+ assert (_transport_speed == 0 || _transport_speed == 1.0 || _transport_speed == -1.0);
+
+ samples_moved = (samplecnt_t) nframes * _transport_speed;
end_sample = _transport_sample + samples_moved;
if (_transport_speed == 1.0) {
samples_moved = (samplecnt_t) nframes;
} else {
- interpolation.set_target_speed (_target_transport_speed);
interpolation.set_speed (_transport_speed);
- samples_moved = (samplecnt_t) interpolation.interpolate (0, nframes, 0, 0);
+ samples_moved = interpolation.distance (nframes);
}
if (!_exporting && !timecode_transmission_suspended()) {
case SessionEvent::PunchIn:
// cerr << "PunchIN at " << transport_sample() << endl;
- if (config.get_punch_in() && record_status() == Enabled && !preroll_record_punch_enabled()) {
+ if (config.get_punch_in() && record_status() == Enabled) {
enable_record ();
}
remove = false;
case SessionEvent::PunchOut:
// cerr << "PunchOUT at " << transport_sample() << endl;
- if (config.get_punch_out() && !preroll_record_punch_enabled()) {
+ if (config.get_punch_out()) {
step_back_from_record ();
}
remove = false;
del = false;
break;
- case SessionEvent::RecordStart:
- if (preroll_record_punch_enabled() && record_status() == Enabled) {
- enable_record ();
- }
- remove = false;
- del = false;
- break;
-
case SessionEvent::StopOnce:
if (!non_realtime_work_pending()) {
_clear_event_type (SessionEvent::StopOnce);
return max_samplepos;
}
- if (preroll_record_punch_enabled ()) {
- return max_samplepos;
- }
-
bool const punching_in = (config.get_punch_in () && _locations->auto_punch_location());
bool const punching_out = (config.get_punch_out () && _locations->auto_punch_location());