mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
make use of measured latency values to set dialog controls, and use actual port latency to compute extra delay
This commit is contained in:
parent
18c4c9656a
commit
91e2eab01a
4 changed files with 35 additions and 1 deletions
|
|
@ -249,6 +249,7 @@ and microphone.\n\n\
|
|||
xopt = AttachOptions(0);
|
||||
|
||||
lm_measure_button.signal_toggled().connect (sigc::mem_fun (*this, &EngineControl::latency_button_toggled));
|
||||
lm_use_button.signal_clicked().connect (sigc::mem_fun (*this, &EngineControl::use_latency_button_clicked));
|
||||
lm_use_button.set_sensitive (false);
|
||||
|
||||
lm_table.attach (lm_measure_button, 0, 2, row, row+1, xopt, (AttachOptions) 0);
|
||||
|
|
@ -972,7 +973,10 @@ EngineControl::check_latency_measurement ()
|
|||
return false;
|
||||
}
|
||||
|
||||
snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms", mtdm->del (), mtdm->del () * 1000.0f/sample_rate);
|
||||
uint32_t frames_total = mtdm->del();
|
||||
uint32_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
|
||||
|
||||
snprintf (buf, sizeof (buf), "%u samples %10.3lf ms", extra, extra * 1000.0f/sample_rate);
|
||||
|
||||
bool solid = true;
|
||||
|
||||
|
|
@ -1016,3 +1020,20 @@ EngineControl::latency_button_toggled ()
|
|||
update_latency_display ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EngineControl::use_latency_button_clicked ()
|
||||
{
|
||||
MTDM* mtdm = ARDOUR::AudioEngine::instance()->mtdm ();
|
||||
|
||||
if (!mtdm) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t frames_total = mtdm->del();
|
||||
uint32_t extra = frames_total - ARDOUR::AudioEngine::instance()->latency_signal_delay();
|
||||
uint32_t one_way = extra/2;
|
||||
|
||||
input_latency_adjustment.set_value (one_way);
|
||||
output_latency_adjustment.set_value (one_way);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ class EngineControl : public ArdourDialog, public PBD::ScopedConnectionList {
|
|||
|
||||
void on_response (int);
|
||||
void control_app_button_clicked ();
|
||||
void use_latency_button_clicked ();
|
||||
void manage_control_app_sensitivity ();
|
||||
int push_state_to_backend (bool start);
|
||||
uint32_t _desired_sample_rate;
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ public:
|
|||
void stop_latency_detection ();
|
||||
void set_latency_input_port (const std::string&);
|
||||
void set_latency_output_port (const std::string&);
|
||||
uint32_t latency_signal_delay () const { return _latency_signal_latency; }
|
||||
|
||||
private:
|
||||
AudioEngine ();
|
||||
|
|
@ -222,6 +223,7 @@ public:
|
|||
framecnt_t _latency_flush_frames;
|
||||
std::string _latency_input_name;
|
||||
std::string _latency_output_name;
|
||||
framecnt_t _latency_signal_latency;
|
||||
|
||||
void meter_thread ();
|
||||
void start_metering_thread ();
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ AudioEngine::AudioEngine ()
|
|||
, _latency_input_port (0)
|
||||
, _latency_output_port (0)
|
||||
, _latency_flush_frames (0)
|
||||
, _latency_signal_latency (0)
|
||||
{
|
||||
g_atomic_int_set (&m_meter_exit, 0);
|
||||
discover_backends ();
|
||||
|
|
@ -1013,6 +1014,15 @@ AudioEngine::start_latency_detection ()
|
|||
return;
|
||||
}
|
||||
|
||||
LatencyRange lr;
|
||||
_latency_signal_latency = 0;
|
||||
lr = pe.get_latency_range (_latency_input_port, false);
|
||||
_latency_signal_latency = lr.max;
|
||||
lr = pe.get_latency_range (_latency_output_port, true);
|
||||
_latency_signal_latency += lr.max;
|
||||
|
||||
cerr << "latency signal pathway = " << _latency_signal_latency << endl;
|
||||
|
||||
/* all created and connected, lets go */
|
||||
|
||||
_mtdm = new MTDM (sample_rate());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue