From df8c0d949ec00c77d2020c60fce29adf66d3bf2a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 20 Jan 2020 06:24:41 +0100 Subject: Engine: debug-print alignment --- libs/ardour/audioengine.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'libs/ardour') 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 */ -- cgit v1.2.3