summaryrefslogtreecommitdiff
path: root/libs/ardour/session_transport.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-05-22 18:09:26 +0200
committerRobin Gareus <robin@gareus.org>2018-07-09 17:30:38 +0200
commit249640267cc9afa7b0f048d56b7e961af6441111 (patch)
treea51c99646a6409a4012987fd3e19b1f61eaf9389 /libs/ardour/session_transport.cc
parent8664768efa99c9186a99e2487581e0107d431833 (diff)
Remove global declick API
De-click will be per disk-reader, latency compensated and buffer-size independent. Cue-monitoring should not be affected by de-click.
Diffstat (limited to 'libs/ardour/session_transport.cc')
-rw-r--r--libs/ardour/session_transport.cc139
1 files changed, 6 insertions, 133 deletions
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 59c4e22f16..bafcc2c8d5 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -808,12 +808,6 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
boost::shared_ptr<RouteList> r = routes.reader ();
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- if (!(*i)->is_auditioner()) {
- (*i)->set_pending_declick (0);
- }
- }
-
if (did_record) {
commit_reversible_command ();
/* increase take name */
@@ -827,11 +821,11 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
PostTransportWork ptw = post_transport_work ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate) || pending_locate_flush);
+ (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate));
}
VCAList v = _vca_manager->vcas ();
for (VCAList::const_iterator i = v.begin(); i != v.end(); ++i) {
- (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate) || pending_locate_flush);
+ (*i)->non_realtime_transport_stop (_transport_sample, !(ptw & PostTransportLocate));
}
update_latency_compensation ();
@@ -844,10 +838,6 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
(_requested_return_sample >= 0) ||
synced_to_engine()) {
- if (pending_locate_flush) {
- flush_all_inserts ();
- }
-
// rg: what is the logic behind this case?
// _requested_return_sample should be ignored when synced_to_engine/slaved.
// currently worked around in MTC_Slave by forcing _requested_return_sample to -1
@@ -988,44 +978,9 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
/* and start it up again if relevant */
- if ((ptw & PostTransportLocate) && !config.get_external_sync() && pending_locate_roll) {
+ if ((ptw & PostTransportLocate) && !config.get_external_sync()) {
request_transport_speed (1.0);
}
-
- /* Even if we didn't do a pending locate roll this time, we don't want it hanging
- around for next time.
- */
- pending_locate_roll = false;
-}
-
-void
-Session::check_declick_out ()
-{
- bool locate_required = transport_sub_state & PendingLocate;
-
- /* this is called after a process() iteration. if PendingDeclickOut was set,
- it means that we were waiting to declick the output (which has just been
- done) before maybe doing something else. this is where we do that "something else".
-
- note: called from the audio thread.
- */
-
- if (transport_sub_state & PendingDeclickOut) {
-
- if (locate_required) {
- start_locate (pending_locate_sample, pending_locate_roll, pending_locate_flush);
- transport_sub_state &= ~(PendingDeclickOut|PendingLocate);
- } else {
- if (!(transport_sub_state & StopPendingCapture)) {
- stop_transport (pending_abort);
- transport_sub_state &= ~(PendingDeclickOut|PendingLocate);
- }
- }
-
- } else if (transport_sub_state & PendingLoopDeclickOut) {
- /* Nothing else to do here; we've declicked, and the loop event will be along shortly */
- transport_sub_state &= ~PendingLoopDeclickOut;
- }
}
void
@@ -1259,22 +1214,6 @@ Session::locate (samplepos_t target_sample, bool with_roll, bool with_flush, boo
return;
}
- if (_transport_speed && !(for_loop_enabled && Config->get_seamless_loop())) {
- /* Schedule a declick. We'll be called again when its done.
- We only do it this way for ordinary locates, not those
- due to **seamless** loops.
- */
-
- if (!(transport_sub_state & PendingDeclickOut)) {
- transport_sub_state |= (PendingDeclickOut|PendingLocate);
- pending_locate_sample = target_sample;
- pending_locate_roll = with_roll;
- pending_locate_flush = with_flush;
- cerr << "Declick scheduled ... back soon\n";
- return;
- }
- }
-
cerr << "... now doing the actual locate\n";
// Update Timecode time
@@ -1622,74 +1561,10 @@ Session::stop_transport (bool abort, bool clear_state)
return;
}
- DEBUG_TRACE (DEBUG::Transport, string_compose ("stop_transport, declick required? %1\n", get_transport_declick_required()));
-
- if (!get_transport_declick_required()) {
-
- /* stop has not yet been scheduled */
+ DEBUG_TRACE (DEBUG::Transport, "time to actually stop\n");
- boost::shared_ptr<RouteList> rl = routes.reader();
- samplepos_t stop_target = audible_sample();
-
- SubState new_bits;
-
- if (actively_recording() && /* we are recording */
- worst_input_latency() > current_block_size) { /* input latency exceeds block size, so simple 1 cycle delay before stop is not enough */
-
- /* we need to capture the audio that is still somewhere in the pipeline between
- wherever it was generated and the process callback. This means that even though
- the user (or something else) has asked us to stop, we have to roll
- past this point and then reset the playhead/transport location to
- the position at which the stop was requested.
-
- we still need playback to "stop" now, however, which is why we schedule
- a declick below.
- */
-
- DEBUG_TRACE (DEBUG::Transport, string_compose ("stop transport requested @ %1, scheduled for + %2 = %3, abort = %4\n",
- _transport_sample, _worst_input_latency,
- _transport_sample + _worst_input_latency,
- abort));
-
- SessionEvent *ev = new SessionEvent (SessionEvent::StopOnce, SessionEvent::Replace,
- _transport_sample + _worst_input_latency,
- 0, 0, abort);
-
- merge_event (ev);
-
- /* request a declick at the start of the next process cycle() so that playback ceases.
- It will remain silent until we actually stop (at the StopOnce event somewhere in
- the future). The extra flag (StopPendingCapture) is set to ensure that check_declick_out()
- does not stop the transport too early.
- */
- new_bits = SubState (PendingDeclickOut|StopPendingCapture);
-
- } else {
-
- /* Not recording, schedule a declick in the next process() cycle and then stop at its end */
-
- new_bits = PendingDeclickOut;
- DEBUG_TRACE (DEBUG::Transport, string_compose ("stop scheduled for next process cycle @ %1\n", _transport_sample));
- }
-
- /* we'll be called again after the declick */
- transport_sub_state = SubState (transport_sub_state|new_bits);
- pending_abort = abort;
-
- return;
-
- } else {
-
- DEBUG_TRACE (DEBUG::Transport, "time to actually stop\n");
-
- /* declick was scheduled, but we've been called again, which means it is really time to stop
-
- XXX: we should probably split this off into its own method and call it explicitly.
- */
-
- realtime_stop (abort, clear_state);
- _butler->schedule_transport_work ();
- }
+ realtime_stop (abort, clear_state);
+ _butler->schedule_transport_work ();
}
/** Called from the process thread */
@@ -1732,8 +1607,6 @@ Session::start_transport ()
break;
}
- transport_sub_state |= PendingDeclickIn;
-
_transport_speed = _default_transport_speed;
_target_transport_speed = _transport_speed;