mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-20 12:26:07 +01:00
make it easier to measure insert latency. do our best to save and recall it
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@6687 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4734896ba6
commit
0cdf9a98cd
3 changed files with 35 additions and 2 deletions
|
|
@ -735,10 +735,25 @@ PortInsertUI::PortInsertUI (Session& sess, boost::shared_ptr<PortInsert> pi)
|
|||
|
||||
pack_start (latency_frame);
|
||||
pack_start (hbox);
|
||||
|
||||
|
||||
update_latency_display();
|
||||
|
||||
latency_button.signal_toggled().connect (mem_fun (*this, &PortInsertUI::latency_button_toggled));
|
||||
}
|
||||
|
||||
void
|
||||
PortInsertUI::update_latency_display ()
|
||||
{
|
||||
nframes_t sample_rate = input_selector.session.engine().frame_rate();
|
||||
if (sample_rate == 0) {
|
||||
latency_display.set_text (_("Disconnected from audio engine"));
|
||||
} else {
|
||||
char buf[64];
|
||||
snprintf (buf, sizeof (buf), "%10.3lf frames %10.3lf ms", (float)_pi->latency(), (float)_pi->latency() * 1000.0f/sample_rate);
|
||||
latency_display.set_text(buf);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PortInsertUI::check_latency_measurement ()
|
||||
{
|
||||
|
|
@ -754,7 +769,7 @@ PortInsertUI::check_latency_measurement ()
|
|||
mtdm->resolve ();
|
||||
}
|
||||
|
||||
char buf[64];
|
||||
char buf[128];
|
||||
nframes_t sample_rate = input_selector.session.engine().frame_rate();
|
||||
|
||||
if (sample_rate == 0) {
|
||||
|
|
@ -780,6 +795,7 @@ PortInsertUI::check_latency_measurement ()
|
|||
if (solid) {
|
||||
_pi->set_measured_latency ((nframes_t) rint (mtdm->del()));
|
||||
strcat (buf, " (set)");
|
||||
latency_button.set_active (false);
|
||||
}
|
||||
|
||||
latency_display.set_text (buf);
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ class PortInsertUI : public Gtk::VBox
|
|||
sigc::connection latency_timeout;
|
||||
bool check_latency_measurement ();
|
||||
void latency_button_toggled ();
|
||||
void update_latency_display();
|
||||
|
||||
Gtk::HBox hbox;
|
||||
IOSelector input_selector;
|
||||
|
|
|
|||
|
|
@ -1024,6 +1024,10 @@ PortInsert::state (bool full)
|
|||
node->add_property ("type", "port");
|
||||
snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
|
||||
node->add_property ("bitslot", buf);
|
||||
snprintf (buf, sizeof (buf), "%u", _measured_latency);
|
||||
node->add_property("latency", buf);
|
||||
snprintf (buf, sizeof (buf), "%u", _session.get_block_size());
|
||||
node->add_property("block_size", buf);
|
||||
|
||||
return *node;
|
||||
}
|
||||
|
|
@ -1046,6 +1050,18 @@ PortInsert::set_state(const XMLNode& node)
|
|||
return -1;
|
||||
}
|
||||
|
||||
uint32_t blocksize = 0;
|
||||
if ((prop = node.property ("block_size")) != 0) {
|
||||
sscanf (prop->value().c_str(), "%u", &blocksize);
|
||||
}
|
||||
|
||||
//if the jack period is the same as when the value was saved, we can recall our latency..
|
||||
if ( (_session.get_block_size() == blocksize) && (prop = node.property ("latency")) != 0) {
|
||||
uint32_t latency = 0;
|
||||
sscanf (prop->value().c_str(), "%u", &latency);
|
||||
_measured_latency = latency;
|
||||
}
|
||||
|
||||
if ((prop = node.property ("bitslot")) == 0) {
|
||||
bitslot = _session.next_insert_id();
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue