From fbe359e8c7e827b4f8b7e26f70ba0ec85ae4f01e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 16 Jun 2014 19:44:23 +0200 Subject: [PATCH] debug alsa midi latency measurement --- gtk2_ardour/engine_dialog.cc | 6 ++++++ libs/ardour/mididm.cc | 3 +++ 2 files changed, 9 insertions(+) diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index f8675a5ad4..df5a6a95f3 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -1920,6 +1920,12 @@ EngineControl::check_midi_latency_measurement () end_latency_detection (); lm_use_button.set_sensitive (true); have_lm_results = true; + return false; + } else if (mididm->processed () > 400) { + have_lm_results = false; + end_latency_detection (); + lm_results.set_markup (string_compose (results_markup, _("Timeout - large MIDI jitter."))); + return false; } lm_results.set_markup (string_compose (results_markup, buf)); diff --git a/libs/ardour/mididm.cc b/libs/ardour/mididm.cc index 6549544efb..b6734bb733 100644 --- a/libs/ardour/mididm.cc +++ b/libs/ardour/mididm.cc @@ -66,6 +66,9 @@ int MIDIDM::process (pframes_t nframes, PortEngine &pe, void *midi_in, void *mid const int64_t tc = (_monotonic_cnt + timestamp) & MASK; const int64_t ti = (buf[2] << 7) | buf[1]; const int64_t tdiff = (MODX + tc - ti) % MODX; +#if 1 //DEBUG + printf("MIDI DELAY: # %4"PRId64" %4"PRId64" [samples]\n", _cnt_total, tdiff); +#endif /* running variance */ if (_cnt_total == 0) {