diff options
-rw-r--r-- | gtk2_ardour/engine_dialog.cc | 21 | ||||
-rw-r--r-- | libs/ardour/ardour/audioengine.h | 2 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 33 |
3 files changed, 40 insertions, 16 deletions
diff --git a/gtk2_ardour/engine_dialog.cc b/gtk2_ardour/engine_dialog.cc index 8c84c5d3b9..40ce03d778 100644 --- a/gtk2_ardour/engine_dialog.cc +++ b/gtk2_ardour/engine_dialog.cc @@ -227,23 +227,21 @@ EngineControl::build_notebook () lm_preamble.set_width_chars (60); lm_preamble.set_line_wrap (true); - lm_preamble.set_markup (_("This tool will allow you to <i>precisely</i> measure the signal delay \ -within your audio hardware setup that is not controlled by Ardour or its audio backend.\n\n\ -Connect the two channels that you select below using either a cable or (less ideally) a speaker \ + lm_preamble.set_markup (_("1. <span weight=\"bold\">Turn down the volume on your hardware to a very low level.</span>\n\n\ +2. Connect the two channels that you select below using either a cable or (less ideally) a speaker \ and microphone.\n\n\ -Once the channels are connected, click the \"Measure latency\" button.\n\n\ -When you are satisfied with the results, click the \"Use results\" button to use them with your audio \ -setup parameters. <i>Note: they will not take effect until you restart</i>")); +3. Once the channels are connected, click the \"Measure latency\" button.\n\n\ +4. When satisfied with the results, click the \"Use results\" button.")); lm_table.attach (lm_preamble, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); row++; - label = manage (left_aligned_label (_("Output channel"))); + label = manage (new Label (_("Output channel"))); lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); lm_table.attach (lm_output_channel_combo, 1, 2, row, row+1, xopt, (AttachOptions) 0); ++row; - label = manage (left_aligned_label (_("Input channel"))); + label = manage (new Label (_("Input channel"))); lm_table.attach (*label, 0, 1, row, row+1, xopt, (AttachOptions) 0); lm_table.attach (lm_input_channel_combo, 1, 2, row, row+1, xopt, (AttachOptions) 0); ++row; @@ -251,7 +249,8 @@ setup parameters. <i>Note: they will not take effect until you restart</i>")); xopt = AttachOptions(0); lm_measure_button.signal_toggled().connect (sigc::mem_fun (*this, &EngineControl::latency_button_toggled)); - + lm_use_button.set_sensitive (false); + lm_table.attach (lm_measure_button, 0, 2, row, row+1, xopt, (AttachOptions) 0); ++row; lm_table.attach (lm_results, 0, 2, row, row+1, AttachOptions(FILL|EXPAND), (AttachOptions) 0); @@ -259,7 +258,7 @@ setup parameters. <i>Note: they will not take effect until you restart</i>")); lm_table.attach (lm_use_button, 0, 2, row, row+1, xopt, (AttachOptions) 0); ++row; - lm_results.set_text ("Measured results: 786 samples"); + lm_results.set_markup ("<i>No measurement results yet</i>"); lm_vbox.pack_start (lm_table, false, false); @@ -974,7 +973,6 @@ EngineControl::check_latency_measurement () static uint32_t cnt = 0; if (mtdm->resolve () < 0) { - cerr << "no resolution\n"; string txt = _("No signal detected "); uint32_t dots = cnt++%10; for (uint32_t i = 0; i < dots; ++i) { @@ -1015,6 +1013,7 @@ EngineControl::check_latency_measurement () if (solid) { // _pi->set_measured_latency (rint (mtdm->del())); lm_measure_button.set_active (false); + lm_use_button.set_sensitive (true); strcat (buf, " (set)"); } diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h index 980f507be5..c9d789d746 100644 --- a/libs/ardour/ardour/audioengine.h +++ b/libs/ardour/ardour/audioengine.h @@ -220,6 +220,8 @@ public: PortEngine::PortHandle _latency_input_port; PortEngine::PortHandle _latency_output_port; framecnt_t _latency_flush_frames; + std::string _latency_input_name; + std::string _latency_output_name; void meter_thread (); void start_metering_thread (); diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 09478e7ef7..249fd4200d 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -985,11 +985,37 @@ AudioEngine::mtdm() void AudioEngine::start_latency_detection () { + PortEngine& pe (port_engine()); + delete _mtdm; + _mtdm = 0; + + /* create the ports we will use to read/write data */ + + if ((_latency_output_port = pe.register_port ("latency_out", DataType::AUDIO, IsOutput)) == 0) { + return; + } + if (pe.connect (_latency_output_port, _latency_output_name)) { + return; + } + + const string portname ("latency_in"); + if ((_latency_input_port = pe.register_port (portname, DataType::AUDIO, IsInput)) == 0) { + pe.unregister_port (_latency_output_port); + return; + } + if (pe.connect (_latency_input_name, make_port_name_non_relative (portname))) { + pe.unregister_port (_latency_output_port); + return; + } + + /* all created and connected, lets go */ _mtdm = new MTDM (sample_rate()); _measuring_latency = true; _latency_flush_frames = samples_per_cycle(); + + } void @@ -1003,14 +1029,11 @@ AudioEngine::stop_latency_detection () void AudioEngine::set_latency_output_port (const string& name) { - _latency_output_port = port_engine().register_port ("latency_out", DataType::AUDIO, IsOutput); - port_engine().connect (_latency_output_port, name); + _latency_output_name = name; } void AudioEngine::set_latency_input_port (const string& name) { - const string portname ("latency_in"); - _latency_input_port = port_engine().register_port (portname, DataType::AUDIO, IsInput); - port_engine().connect (name, make_port_name_non_relative (portname)); + _latency_input_name = name; } |