summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-01-20 06:24:41 +0100
committerRobin Gareus <robin@gareus.org>2020-01-24 19:15:21 +0100
commitdf8c0d949ec00c77d2020c60fce29adf66d3bf2a (patch)
tree8cc4700dbb87b01c1ad59c7d7d1e2cc47cf2fb0d /libs/ardour/audioengine.cc
parent72e385af46bd5774ae1af39b616414b950090c0d (diff)
Engine: debug-print alignment
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index aa6239794f..1fcf285437 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -424,6 +424,27 @@ AudioEngine::process_callback (pframes_t nframes)
const double engine_speed = tmm.pre_process_transport_masters (nframes, sample_time_at_cycle_start());
Port::set_speed_ratio (engine_speed);
DEBUG_TRACE (DEBUG::Slave, string_compose ("transport master (current=%1) gives speed %2 (ports using %3)\n", tmm.current() ? tmm.current()->name() : string("[]"), engine_speed, Port::speed_ratio()));
+#if 0 // USE FOR DEBUG ONLY
+ /* use with Dummy backend, engine pulse and
+ * scripts/_find_nonzero_sample.lua
+ * to correlate with recorded region alignment.
+ */
+ static bool was_rolling = false;
+ bool is_rolling = _session->transport_rolling();
+ if (!was_rolling && is_rolling) {
+ samplepos_t stacs = sample_time_at_cycle_start ();
+ samplecnt_t sr = sample_rate ();
+ samplepos_t tp = _session->transport_sample ();
+ /* Note: this does not take Port latency into account:
+ * - always add 12 samples (Port::_resampler_quality)
+ * - ExistingMaterial: subtract playback latency from engine-pulse
+ * We assume the player listens and plays along. Recorded region is moved
+ * back by playback_latency
+ */
+ printf (" ******** Starting play at %ld, next pulse: %ld\n", stacs, ((sr - (stacs % sr)) %sr) + tp);
+ }
+ was_rolling = is_rolling;
+#endif
}
/* tell all relevant objects that we're starting a new cycle */