summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-10-15 15:57:35 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-10-15 15:57:35 +0000
commitcb84e71caa6faa3694a9c1958d24a67d02839326 (patch)
treef1f2c2732c14af8e27d93ce19fb7ba1dd39e0047 /libs/ardour/audioengine.cc
parent6ab663342df34cd5b9ceb27efda49ee65f5b6967 (diff)
create and manage a new config parameter that defines where LTC originates (still some tweaks to be done here and there)
git-svn-id: svn://localhost/ardour2/branches/3.0@13280 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc73
1 files changed, 60 insertions, 13 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index 9fb1d1d706..ba7666f3e4 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -89,13 +89,24 @@ AudioEngine::AudioEngine (string client_name, string session_uuid)
}
Port::set_engine (this);
+
#ifdef HAVE_LTC
- _ltc_input = new AudioPort ("LTC in", Port::IsInput);
+ _ltc_input = register_port (DataType::AUDIO, _("LTC in"), Port::IsInput);
+
+ /* As of October 2012, the LTC source port is the only thing that needs
+ * to care about Config parameters, so don't bother to listen if we're
+ * not doing LTC stuff. This might change if other parameters show up
+ * in the future that we need to care about with or without LTC.
+ */
+
+ Config->ParameterChanged.connect_same_thread (config_connection, boost::bind (&AudioEngine::parameter_changed, this, _1));
#endif
}
AudioEngine::~AudioEngine ()
{
+ config_connection.disconnect ();
+
{
Glib::Threads::Mutex::Lock tm (_process_lock);
session_removed.signal ();
@@ -210,6 +221,9 @@ AudioEngine::start ()
_running = true;
_has_run = true;
Running(); /* EMIT SIGNAL */
+
+ reconnect_ltc ();
+
} else {
// error << _("cannot activate JACK client") << endmsg;
}
@@ -377,31 +391,38 @@ void
AudioEngine::_connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int conn, void* arg)
{
AudioEngine* ae = static_cast<AudioEngine*> (arg);
+ ae->connect_callback (id_a, id_b, conn);
+}
- if (ae->port_remove_in_progress) {
+void
+AudioEngine::connect_callback (jack_port_id_t id_a, jack_port_id_t id_b, int conn)
+{
+ if (port_remove_in_progress) {
return;
}
- GET_PRIVATE_JACK_POINTER (ae->_jack);
+ GET_PRIVATE_JACK_POINTER (_jack);
jack_port_t* jack_port_a = jack_port_by_id (_priv_jack, id_a);
jack_port_t* jack_port_b = jack_port_by_id (_priv_jack, id_b);
boost::shared_ptr<Port> port_a;
boost::shared_ptr<Port> port_b;
+ Ports::iterator x;
+ boost::shared_ptr<Ports> pr = ports.reader ();
- boost::shared_ptr<Ports> pr = ae->ports.reader ();
- Ports::iterator i = pr->begin ();
- while (i != pr->end() && (port_a == 0 || port_b == 0)) {
- if (jack_port_a == i->second->jack_port()) {
- port_a = i->second;
- } else if (jack_port_b == i->second->jack_port()) {
- port_b = i->second;
- }
- ++i;
+
+ x = pr->find (make_port_name_relative (jack_port_name (jack_port_a)));
+ if (x != pr->end()) {
+ port_a = x->second;
+ }
+
+ x = pr->find (make_port_name_relative (jack_port_name (jack_port_b)));
+ if (x != pr->end()) {
+ port_b = x->second;
}
- ae->PortConnectedOrDisconnected (
+ PortConnectedOrDisconnected (
port_a, jack_port_name (jack_port_a),
port_b, jack_port_name (jack_port_b),
conn == 0 ? false : true
@@ -1470,6 +1491,8 @@ AudioEngine::reconnect_to_jack ()
MIDI::Manager::instance()->reconnect ();
+ reconnect_ltc ();
+
Running (); /* EMIT SIGNAL*/
start_metering_thread ();
@@ -1613,3 +1636,27 @@ AudioEngine::destroy ()
delete _instance;
_instance = 0;
}
+
+void
+AudioEngine::parameter_changed (const std::string& s)
+{
+ if (s == "ltc-source-port") {
+ reconnect_ltc ();
+ }
+
+}
+
+void
+AudioEngine::reconnect_ltc ()
+{
+ if (_ltc_input) {
+
+ string src = Config->get_ltc_source_port();
+
+ _ltc_input->disconnect_all ();
+
+ if (src != _("None") && !src.empty()) {
+ _ltc_input->connect (src);
+ }
+ }
+}