diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-16 19:58:34 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-16 19:58:34 +0000 |
commit | a4d9d09af5853f769e1143c2353806bfb7d89f58 (patch) | |
tree | 05dc35268557395124f130ec8b6d8e32c6e49b7b /gtk2_ardour/io_selector.cc | |
parent | 0b2f156c5850fb1c60aae25df4b9767bd7f92b89 (diff) |
forward port 2.X changes up to and including rev 6714
git-svn-id: svn://localhost/ardour2/branches/3.0@7635 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/io_selector.cc')
-rw-r--r-- | gtk2_ardour/io_selector.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/gtk2_ardour/io_selector.cc b/gtk2_ardour/io_selector.cc index 9399a6aaa7..2bf112ef8e 100644 --- a/gtk2_ardour/io_selector.cc +++ b/gtk2_ardour/io_selector.cc @@ -159,7 +159,7 @@ IOSelector::get_state (ARDOUR::BundleChannel c[2]) const ARDOUR::Bundle::PortList const & our_ports = c[_ours].bundle->channel_ports (c[_ours].channel); ARDOUR::Bundle::PortList const & other_ports = c[_other].bundle->channel_ports (c[_other].channel); - if (our_ports.empty() || other_ports.empty()) { + if (!_session || our_ports.empty() || other_ports.empty()) { /* we're looking at a bundle with no parts associated with this channel, so nothing to connect */ return PortMatrixNode::NOT_ASSOCIATED; @@ -286,9 +286,26 @@ PortInsertUI::PortInsertUI (Gtk::Window* parent, ARDOUR::Session* sess, boost::s pack_start (output_selector, true, true); pack_start (input_selector, true, true); + 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 () { @@ -304,7 +321,7 @@ PortInsertUI::check_latency_measurement () mtdm->resolve (); } - char buf[64]; + char buf[128]; nframes_t sample_rate = AudioEngine::instance()->frame_rate(); if (sample_rate == 0) { @@ -329,6 +346,7 @@ PortInsertUI::check_latency_measurement () if (solid) { _pi->set_measured_latency ((nframes_t) rint (mtdm->del())); + latency_button.set_active (false); strcat (buf, " (set)"); } |